eliminate some left-recursion, reformat a bit

This could be entirely correct... but it's so darn slow that I can't
run it on all the sources to test. sad face.
eliminate unnecessary generators from test script