Fix bugs in parser and add tests

Notably, this fixes the parser backtracking all the way to the start when it
encounters an operator it doesn't know about.  While here, token-ize
constituent parsers and move parser export types to their own module.