Massive rewrite of parser, now two-step

Also found bug in old parser: precedence was backwards