3.6 pyggy.pyggy - Grammar generation

This module implements the parser generator. It is responsible for reading in a parser spec file (in .pyg format), generating a shift-reduce tables and emitting the tables into a Python module.

This module can be accessed from the command line or through a call from Python. To run from the command line:

$ python pyggy.py [-d debuglevel] infile.pyg outfile.py

pyggy.pyggy.parsespec( fname, outfname, debug=0)
The parsespec function causes the input file fname to be processed and shift-reduce tables to be generated to fname. If debug is set, increasing amounts of diagnostic output will be emitted. The debug levels (especially higher-levels) are subject to change but are currently:

Level  Description 
0 Output a count of ambiguities in the parser.
1 Output detailed diagnostics of the generated parser.
2 Turn on debugging in the parser generator engine and show precedence relations.
3 Show the LR0 state machine
11 Show the parse tree from the spec file with dotty.
12 Show the cover while showing the parse tree.

This function may raise pyggy.SpecError if there are any errors in the spec file or pyggy.InternalError.

See the PyGgy Home Page.