ply
Python Lex & Yacc
Decision gist · record as of 2026-08-14
Yes, with conditions. PLY is worth installing if you need a straightforward, dependency-free lex/yacc implementation for an existing project, educational work, or a simple DSL parser. The permissive license and zero runtime dependencies make it low-risk to add. However, do not use it for new production systems: the abandonment since 2018-02-15 means no modern Python compatibility assurance, no security updates, and no modern parsing alternatives. For new work, evaluate actively maintained options first.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- The package claims compatibility with both Python 2 and Python 3, but given the abandonment since 2018, modern Python version support is unverified.
- Installation is frictionless with no runtime dependencies.
- However, the package has been abandoned since its latest release on 2018-02-15 with no maintenance activity, so you should expect no bug fixes, security patches, or compatibility updates.
License · maintenance · safety
BSD (permissive) — PLY is licensed under the permissive BSD license, which allows commercial and private use with minimal restrictions—you may use, modify, and distribute it freely provided you retain the license notice.
last release 2018-02-15 (3102 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 44,096,150 downloads/mo, #634 on PyPI
Alternatives
Verify before relying
pip install ply
from ply import lex, yacc
lexer = lex.lex()
parser = yacc.yacc()- Whether PLY continues to work reliably on modern Python versions without undocumented compatibility issues.
- Whether the LALR(1) parser generator remains performant for modern grammar complexity and scale.
- What the current state of error recovery and ambiguous grammar handling is in practice.
What it is and what it does
PLY is a pure-Python implementation of the classic lex and yacc compiler-construction tools. It generates lexical analyzers (tokenizers) and parsers from declarative specifications, using LALR(1) parsing to handle context-free grammars efficiently. The package supports standard features like precedence rules, error recovery, and empty productions, making it suitable for building domain-specific languages, configuration file parsers, and other language-processing tools.
The main appeal is that everything runs in Python with no external C dependencies, and the library provides extensive error checking during grammar definition. However, PLY has been unmaintained since 2018-02-15, meaning no updates for Python language evolution, security issues, or modern parsing techniques. It remains widely used, likely due to legacy projects and educational use, but new projects should carefully consider whether an actively maintained alternative better suits their needs.
Use it for
- Build a domain-specific language (DSL) parser for configuration files or query languages.
- Create a calculator or expression evaluator that parses and evaluates mathematical or logical syntax.
- Parse custom markup or templating languages for code generation or document processing.
- Implement a simple compiler or interpreter frontend for educational or prototyping purposes.
- Tokenize and parse structured text formats where regex alone is insufficient.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, with conditions.
PLY is worth installing if you need a straightforward, dependency-free lex/yacc implementation for an existing project, educational work, or a simple DSL parser. The permissive license and zero runtime dependencies make it low-risk to add. However, do not use it for new production systems: the abandonment since 2018-02-15 means no modern Python compatibility assurance, no security updates, and no modern parsing alternatives. For new work, evaluate actively maintained options first.
Install
ply on PyPI
Before you install
Installation is frictionless with no runtime dependencies. However, the package has been abandoned since its latest release on 2018-02-15 with no maintenance activity, so you should expect no bug fixes, security patches, or compatibility updates.
The package claims compatibility with both Python 2 and Python 3, but given the abandonment since 2018, modern Python version support is unverified.
License in practice
PLY is licensed under the permissive BSD license, which allows commercial and private use with minimal restrictions—you may use, modify, and distribute it freely provided you retain the license notice.
Quickstart
pip install ply
from ply import lex, yacc
lexer = lex.lex()
parser = yacc.yacc()
Verify before relying
- Whether PLY continues to work reliably on modern Python versions without undocumented compatibility issues.
- Whether the LALR(1) parser generator remains performant for modern grammar complexity and scale.
- What the current state of error recovery and ambiguous grammar handling is in practice.
Package facts
| License | BSD permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Abandoned 3,102 days since the last release |
| First released | |
| Downloads | 44,096,150 / month, #634 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Programming Language :: Python :: 2Programming Language :: Python :: 3 |
Evidence: ply-3.11-py2.py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “lex yacc python”
- plyPLY is a lexer and parser generator for Python that implements lex…
- rplyRPLY is a pure Python parser generator that creates lexers and…
- slySLY is a pure-Python implementation of lex and yacc for building…
Give your agent the search over MCP, or paste the wish link into any chat.
Similar packages
phply is a lexer and parser for PHP source code that generates abstract syntax trees, enabling PHP code analysis and conversion to other formats like JSON or Jinja2 templates.
RPLY is a pure Python parser generator that creates lexers and parsers from grammar rules, compatible with both standard Python and RPython.
However, it has received no updates since January 2021 and is no longer maintained—use it only for projects where you can tolerate no future fixes or Python version…
SLY is a pure-Python implementation of lex and yacc for building lexers and parsers using LALR(1) parsing, with no code generation step required.
Install only if you are maintaining existing code that already depends on SLY, or if you are willing to fork and maintain it yourself.
Funcparserlib is a recursive descent parsing library that lets you build LL(*) parsers for little languages and domain-specific languages using functional combinators, with a built-in lexer generator for token tracking.
javalang is a pure Python lexer and parser for Java 8 source code that builds an abstract syntax tree you can traverse to extract information about Java classes, methods, and other language elements.
Parses Lucene Query DSL syntax into an abstract syntax tree, enabling inspection, analysis, and transformation of search queries for use with Elasticsearch or custom backends.
Install it if you need to accept Lucene syntax from users and convert it to Elasticsearch or apply custom query logic.
See also textX · lark-parser · Parsley · pytokens