grako / examples / regexp /

The branch '1.0' does not exist.
Filename Size Date modified Message
347 B
909 B
2.5 KB
493 B
977 B
765 B

Regexp to Grako

Parse a regular expression, translate it to CFGs in Grako EBNF grammar notation, and generate a Grako PEG_ parser for the grammar.

The project has no practical use, but it's complete yet concise example of how to implement translators in Grako'.

The parser builds an OO model of each parsed regexp using semantic actions. The model generates a Grako grammar with the help the rendering module using inline templates. The generated grammar is then parsed to generate a parser. The generated parser can be executed thus:

$ python data/valid S0

For a list of the generated parser rules use:

$ python -l

To build the project, issue:

$ make