skillfed

pyleri

Python Left-Right Parser

pyleri v1.5.1 124.6K downloads/30d#11,863 on PyPI124
Permissive license Active released

What it is and what it does

Pyleri is a parser generator that lets you define a formal grammar as a Python class, then use it to parse and validate strings. You compose grammars from building blocks like Keywords, Regex patterns, Sequences, and Choices, then call parse() to check whether a string matches. The parser returns a result object with validation status, position, parse tree, and error expectations.

The package's main strength is cross-language export: once you define a grammar in Python, you can generate equivalent parsers in JavaScript (via jsleri), C (via libcleri), Go (via goleri), and Java (via jleri). This makes it useful for projects that need consistent parsing logic across multiple codebases—for instance, a web app with a Python backend and JavaScript frontend, or a database query language that needs to validate input in multiple services.

Use it for:

  • Define a query language grammar once in Python and export it to JavaScript for browser-side validation and autocompletion
  • Validate domain-specific language (DSL) syntax in a Python application before processing
  • Build a parser for a custom configuration file format and reuse it across Python, C, and Go microservices
  • Generate error messages showing what tokens are expected at a parse failure position
  • Create a grammar for a database query language and export it to multiple client libraries

Worth the install?

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

Pyleri is a left-right parser generator that lets you define a grammar in Python and parse strings against it, with the ability to export that grammar to JavaScript, C, Go, and Java.

Yes. Pyleri is actively maintained, has no dependencies, installs easily, carries no security vulnerabilities, and solves a real problem—defining grammars once and reusing them across languages. It's most valuable if you need consistent parsing logic in multiple codebases; for single-language parsing, a simpler tool may suffice.

Install

pyleri on PyPI

pip

pip install pyleri

uv

uv add pyleri

poetry

poetry add pyleri

Installing pyleri

Before you install

Low install friction with no runtime dependencies. The package is actively maintained, with a recent release 39 days ago and consistent commit activity.

License in practice

Licensed under MIT (permissive), so you can use, modify, and distribute the package freely in commercial and private projects.

Quickstart

from pyleri import Grammar, Keyword, Regex, Sequence

class MyGrammar(Grammar):
    k_hi = Keyword('hi')
    r_name = Regex('(?:"(?:[^"]*)")+')
    START = Sequence(k_hi, r_name)

my_grammar = MyGrammar()
result = my_grammar.parse('hi "Iris"')
print(result.is_valid)  # True

Verify before relying

  • Whether the package supports Python 3.11+ despite classifiers only listing up to 3.10
  • Performance characteristics when parsing large or deeply nested grammars
  • Whether exported grammars in other languages maintain full feature parity with the Python version

Package facts

License not declared (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 39 days since the last release
Last repo commit
First released
Downloads 124,563/month — #11,863 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pyleri-1.5.1-py3-none-any.whl

Keywords: parser, grammar, autocompletion

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python ModulesTopic :: Text Processing :: Linguistic

Tags

parser generator pythongrammar definition languageleft-right parsercross-language grammar exportautocompletion parserquery language parsersyntax validation
parser-generatorcross-languagegrammar-definition

More Python Modules packages