PLY (Python Lex-Yacc)

Welcome to the PLY homepage. PLY is an implementation of lex and yacc parsing tools for Python. If you don't have the slightest idea what that means, you're probably in the wrong place. Otherwise, keep reading.

In a nutshell, PLY is nothing more than a straightforward lex/yacc implementation. Here is a list of its essential features:

The original version of PLY was developed in 2001 for use in an Introduction to Compilers course where students used it to build a compiler for a simple Pascal-like language. Because of its use in an instructional setting, a lot of work went into providing extensive error checking. In addition, this experience was used to sort out common usability problems. Since then, a variety of incremental improvements have been made to the system.

Current Status

Work on PLY-4.0 has started and represents a major overhaul and modernization for Python 3.6+. You can only get this version from the GitHub repo at If you looking for a legacy version, you should continue to use version 3.11.


Some Projects Using PLY


Important Note

PLY is no longer maintained as pip-installable package. Although no new features are planned, it continues to be maintained and modernized. If you want to use the latest version, you need to check it out from the PLY GitHub page. If you are looking for a parser generator with a more modern flavor look at the SLY Project.


02/22/2020 PLY-4.0 started. This version drops Python 2 support, table files, and wide assortment of crufty legacy code. You can obtain it from GitHub.

02/15/2018 PLY-3.11 is released.

01/31/2017 PLY-3.10 is released.

8/31/2016. PLY-3.9 is released. Minor bug fixes.

10/2/2015. PLY-3.8 is released. Minor bug fixes only.

8/25/2015. PLY-3.7 is released. Minor bug fixes.

4/26/2015. PLY-3.6 is released. A fair bit of cleanup and a few new features. Note: PLY-3.5 had some critical bugs and has been withdrawn.

2/17/2011. PLY-3.4 is released. Minor bug fixes for Python 3.2

9/2/2009. PLY-3.3 is released. This is a minor bug-fix release.

3/24/2009. PLY-3.2 is released. This is just a minor bug-fix release for the PLY-3.x series.

2/28/2009. PLY-3.1 is released. This is just a minor bug-fix release to PLY-3.0.

2/6/2009. PLY-3.0 is released. This release adds support for Python 2.6 and 3.0. In addition, huge parts of PLY's internals have been refactored to simplify maintenance and further expansion.

5/28/2008. PLY-2.5 is released. This release fixes a number of outstanding bugs, provides improved error handling, and may run even faster than Ply-2.3. Note: The PLY-2.4 release was withdrawn due to a critical error. Please upgrade to PLY-2.5 if you downloaded that version.

2/19/2007. PLY-2.3 is released. This release makes some performance improvements and fixes a bug with start conditions in the lexer.

11/21/2006. The PLY source code repository is now available on Google Code.

11/1/2006. PLY-2.2 is released. This release includes some minor bug fixes and some enhancements to the lex module.

10/2/2006. PLY-2.1 is released. This release features a variety of major improvements including an overhaul of the lexer, new parsing features such as support for inherited attributes, embedded actions, and character literals, improved packaging, and new examples.

9/15/2006. ply-hack, a Google group dedicated to PLY has been launched.

9/8/2006. PLY-2.0 is released. This is the most significant PLY release in several years. Features a completely new implementation of the LALR(1) table generator that is not only faster, but which also seems to produces correct results! If you experienced problems with LALR(1) parsing in PLY-1.x releases, you definitely want to download this version. Note: PLY-2.0 is the first in a series of releases that will be adding significant new features to PLY.

8/2/2006. PLY-1.8 is released. This release fixes a very subtle parsing bug with LALR(1) parsing. Update (8/9/2006): there is still a weird bug in LALR(1) parsing. Please download version 2.0 instead.

5/24/2006. PLY-1.7 is released. This release fixes a number of subtle bugs and adds better support for Unicode.

5/27/2005. PLY-1.6 is released. This release includes a much-awaited patch to fix problems with LALR(1) parsing. Contributed by Christopher Stawarz.

6/1/2004. PLY-1.5 is released. This releases includes full LALR(1) support (contributed by Elias Ioup). Check it out!

4/23/2004. PLY-1.4 is released. This includes some nice usability enhancements to the output files and cleans up a few things.

2/1/2003. PLY-1.3.1 is released. Patch to fix a minor (but critical) typo in precedence checking code.

12/12/2002. PLY-1.3 is released. Minor bugs fixes.

11/27/2002. PLY-1.2 is released. This release contains a few bug fixes, improvements to support Python's optimize mode, and better state management.

10/25/2001. PLY-1.1 is released. This release contains a few bug fixes and minor improvements.

6/18/2001. PLY-1.0 released.


PLY-3.2 and newer releases are distributed under a BSD-license. Older versions are licensed under the terms of the Lesser GPL (LGPL).

Guity Parties

PLY was originally created by David Beazley who continues to maintain it in his spare time---mostly for his own diabolical amusement. If you like it and want to make it even better, please submit bug reports and feature requests. Also consider joining the ply-hack group.

The following people have made various contributions to PLY in the form of bug reports, feature requests, and patches.

Come Take a Course!

If you'd like to learn more about writing compilers more generally, come take a class. You'll learn a lot.

Copyright (C) 2005-2024, David Beazley