May 27, 2005
Announcing : PLY-1.6 (Python Lex-Yacc) http://www.dabeaz.com/ply
I'm pleased to announce a new update to PLY---a 100% Python implementation of the common parsing tools lex and yacc. PLY was originally written to support an introduction to compilers course and has been freely available since 2001. However, the 1.6 release expands PLY's capabilities to include full LALR(1) parsing just like the popular yacc and bison tools (earlier versions of PLY only provided SLR parsing).
Here are a few PLY highlights:
PLY is closely modeled after traditional lex/yacc. If you know how to use these tools in C, you will find PLY to be similar.
PLY provides very extensive error reporting and diagnostic information to assist in parser construction. The original implementation was developed for instructional purposes. As a result, the system tries to identify the most common types of errors made by novice users.
PLY provides full support for empty productions, error recovery, precedence rules, and moderately ambiguous grammars.
Parsing is based on LR-parsing which is fast, memory efficient, better suited to large grammars, and which has a number of nice properties when dealing with syntax errors and other parsing problems. Currently, PLY can build its parsing tables using either SLR or LALR(1) algorithms. Note: traditional yacc tools typically use LALR(1).
PLY can be used to build parsers for large programming languages. Although it is not ultra-fast due to its Python implementation, PLY can be used to parse grammars consisting of several hundred rules (as might be found for a language like C). The lexer and LR parser are also reasonably efficient when parsing normal sized programs.
More information about PLY can be obtained on the PLY webpage at:
PLY is freely available and is licensed under the terms of the Lesser GNU Public License (LGPL).
David Beazley (http://www.dabeaz.com)