skillfed

rply

A pure Python Lex/Yacc that works with RPython

rply v0.7.8 542.3K downloads/30d#6,089 on PyPI
Permissive license BSD 3-Clause License Abandoned released

What it is and what it does

RPLY is a parser generator library that lets you define lexical and syntactic rules for parsing custom languages or domain-specific syntax. You write token rules (lexer) and grammar productions (parser) as Python decorators, then build a lexer and parser that can tokenize and parse input strings. It's a direct port of PLY (Python Lex-Yacc) with a cleaner API and support for RPython, a statically-typed Python subset used by PyPy.

The library is designed for building interpreters, domain-specific languages, or any tool that needs to parse structured text. It handles operator precedence, error reporting with source positions, and optional caching of compiled grammars. The box pattern (wrapping values in classes) is built in for RPython compatibility but can be ignored in pure-Python projects.

Use it for:

  • Build a simple calculator or expression evaluator that parses and computes mathematical expressions.
  • Create a domain-specific language (DSL) parser for configuration files or query languages.
  • Implement an interpreter for a toy programming language or scripting syntax.
  • Parse structured text formats where regex alone is insufficient.
  • Develop a PyPy-compatible parser when RPython support is required.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

RPLY is a pure Python parser generator that creates lexers and parsers from grammar rules, compatible with both standard Python and RPython.

Yes, if you need a parser generator and are comfortable with abandoned software. RPLY is stable, has no known vulnerabilities, and works well for building parsers in pure Python. 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 support updates. For active alternatives, consider PLY or more modern parser libraries.

Install

rply on PyPI

pip

pip install rply

uv

uv add rply

poetry

poetry add rply

Installing rply

Before you install

Installation is straightforward with a single lightweight dependency (appdirs) and a pure-Python wheel. However, the package is abandoned—last released in January 2021 with no activity since, so expect no bug fixes or maintenance.

License in practice

BSD 3-Clause License is permissive, allowing commercial and private use with minimal restrictions; attribution and license inclusion are required.

Quickstart

pip install rply

from rply import LexerGenerator, ParserGenerator
from rply.token import BaseBox

lg = LexerGenerator()
lg.add("NUMBER", r"\d+")
lg.add("PLUS", r"\+")
lg.ignore(r"\s+")

pg = ParserGenerator(["NUMBER", "PLUS"])
@pg.production("expr : NUMBER PLUS NUMBER")
def expr(p):
    return int(p[0].getstr()) + int(p[2].getstr())

lexer = lg.build()
parser = pg.build()
result = parser.parse(lexer.lex("1 + 2"))

Requires understanding of lexer/parser concepts; RPython support is optional but the box pattern (wrapping values) is necessary for RPython compatibility.

Verify before relying

  • Whether the package still works reliably with Python 3.8+ given the 2021 release date and no recent maintenance.
  • Whether cached parsers (cache_id feature) remain compatible across Python versions without manual invalidation.

Package facts

License BSD 3-Clause License (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 1 — appdirs
Maintenance abandoned — 2,025 days since the last release
First released
Downloads 542,262/month — #6,089 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: rply-0.7.8-py2.py3-none-any.whl

Tags

parser generator pythonlexer yacc plygrammar rule parserrpython parsertoken lexer generatorlex yacc alternative
parser-generatorlexerrpython

More Software Development packages