PLY (Python Lex-Yacc)
Welcome to the PLY homepage. PLY is yet another implementation of
lex and yacc for Python. Although several other parsing tools
are available for Python, there are several reasons why
you might want to take a look at PLY:
- It's implemented entirely in Python.
- It uses LR-parsing which is reasonably efficient and well
suited for larger grammars.
- PLY provides most of the standard lex/yacc features
including support for empty productions, precedence rules,
error recovery, and support for ambiguous grammars.
- PLY is extremely easy to use and provides very extensive
error checking.
The original version of PLY was developed for an Introduction to
Compilers course where students used it to build a compiler for a
simple Pascal-like language. Their compiler had to include lexical
analysis, parsing, type checking, type inference, nested scoping, and
generation of assembly code for the SPARC processor. Because of this,
the current implementation has been extensively tested and debugged.
In addition, most of the API and error checking facilities have been
adapted to address common usability problems.
Links
Copyright
PLY is free software and may be distributed under the terms of the
Lesser GPL (LGPL).
More information
PLY is developed in my spare time. If you like it and would like to
make it even better, please contact me.
Other Python Parsing Tools
Check out these links for more information about parsing in Python:
beazley@cs.uchicago.edu