pycc is a compiler-compiler built in python. Given a grammar Context Free Grammar (CFG), pycc will generate an LL-compiler that recognizes strings of that grammar.
pycc also does some basic grammar normalization:
- left factoring
- left recursion removal
As with rexpy, inspiration originally struck while reading about context free grammars and their compilation in Michael Sipser's Introduction to the Theory of Computation.
I find compilers fascinating as they represent the translation from serial information into a grammatical tree that can represent thought.
In addition to Sipser's book, I referred to MIT and Stanford course notes on compilers for building my LL-compiler generator. This handout was particularly useful and most of the techniques I use come directly from it.
- read BNF grammar from file
- add usage with BNF reader to README
- add indirect left recursion removal to normalization
- add escape characters to grammar (optional)
- docstrings where appropriate