aosabook/500lines — pull request #42 by hausdorff (2014-03-03 08:02:29+00:00)
Title: Add lexer and parser for Python 3

The necessities for building, like the `.cabal` file and `Makefile` are in the root directory (i.e., `parser-and-lexer/`).

The code under submission is in `src/`, and the code that supports that code (e.g., code to interface with libraries, or do pretty printing) is under `src/lib/`.

The code itself is still a little overweight, but is approaching what it should look like. The parser is in `src/Parser.hs`, and clocks in at nearly 700 lines (this will shrink soon). The lexer is in `src/Lexer.hs`, and clocks in at just over 500 lines, but will be easily compressed. What work really remains to be done is to compress `src/LexerUtils.hs`, which contains all the regexes used to lex the Python. There additionally are `src/PowLex.hs` and `src/PowParse.hs`, which are both < 10 line files that contain "main" methods for the lexer and parser respectively. At this point they too are under submission, though there isn't anything interesting going on in there.

TO REVIEWERS: I recommend you start with the parser first, because it has an accompanying [http://blog.nullspace.io/obvious-python-parser.html](blog post) right now, while the lexer does not. It is also much closer to the final product, with great pains taken to make it as readable as possible.