ANN: PLY-2.1 (Python Lex-Yacc)

David Beazley dave-announce at
Tue Oct 3 18:35:00 CEST 2006

October 2, 2006

                   Announcing :  PLY-2.1 (Python Lex-Yacc)


I'm pleased to announce a significant new update to PLY---a 100% Python
implementation of the common parsing tools lex and yacc.  PLY-2.1 builds
upon the reimplementation of LALR(1) parsing that appeared in PLY-2.0  
adds a number of significant new features.  These include:

- Elimination of internal limitations due to the use of Python's re

- Better support for inherited attributes and embedded parsing

- Character literals (e.g., '+', '-') can now be included in
   grammar specifications.

- Improved packaging.  PLY is now a proper Python package.

- Improved support for line number and column tracking.

- Added diagnostics.

- New examples including a program to convert tradition yacc/bison
   specifications to PLY.

- A variety of minor enhancements and bug fixes.

If you are new to PLY, here are a few highlights:

-  PLY is closely modeled after traditional lex/yacc.  If you know how
    to use these or similar tools in other languages, you will find
    PLY to be comparable.

-  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 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.

-  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 (

More information about the Python-announce-list mailing list