Parsley
Parsing and pattern matching made easy.
What it is and what it does
Parsley is a parsing library that implements OMeta, an object-oriented pattern-matching language. Instead of using traditional parser generators like yacc or ANTLR that compile to state machine tables, Parsley uses the PEG (Parsing Expression Grammar) algorithm, where each grammar rule reads like a Python expression. You define rules using a readable syntax—sequences, alternatives, repetition, lookahead, and embedded Python actions—then call makeGrammar() to compile them into a Python class with methods for each rule.
The library is designed for developers who find traditional parser generators intimidating or cumbersome. Rules are evaluated in order (unlike table-driven parsers), and you can bind values, call other rules, and execute Python expressions directly within the grammar. It trades the power of LR parsing for simplicity and readability, making it suitable for domain-specific languages, configuration formats, and other structured text parsing tasks where the grammar fits the PEG model.
Use it for:
- Parse domain-specific languages or configuration file formats where PEG semantics are sufficient
- Build simple expression evaluators or query languages with embedded Python actions
- Tokenize and structure text when traditional regex or string splitting is too rigid
- Prototype parsers quickly without learning yacc, bison, or ANTLR state machine concepts
- Define grammar rules that read naturally as Python-like expressions for team readability
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parsley is a PEG-based parsing library that compiles grammar rules into Python classes, letting you define parsers using a readable pattern-matching syntax instead of state machine tables.
No—unless you are maintaining legacy code already using Parsley. The package is abandoned (last release 2015, no commits since), with no Python version guarantee and no active maintenance. For new projects, use maintained PEG parsers like pyparsing or lark, which offer similar readability with ongoing support and bug fixes.
Install
parsley on PyPI
pip
pip install parsleyuv
uv add parsleypoetry
poetry add parsleyInstalling Parsley
Before you install
Installation is straightforward with no runtime dependencies. However, the package is abandoned—last released in 2015 with no commits or maintenance signals since. Use only if you accept that bugs and compatibility issues will not be addressed.
License in practice
MIT License permits commercial and private use, modification, and distribution with minimal restrictions, making it legally safe to adopt from a licensing perspective.
Quickstart
from parsley import makeGrammar
grammar = """
ones = '1' '1' -> 1
twos = '2' '2' -> 2
stuff = (ones | twos)+
"""
Example = makeGrammar(grammar, {})
g = Example("11221111")
result = g.stuff()
Verify before relying
- Whether Parsley remains compatible with current Python versions (no requires_python specified in metadata)
- Whether the OMeta semantics and PEG algorithm implementation are suitable for your specific parsing task
- Community forks or maintained alternatives that may have addressed issues since 2015
Package facts
| License | MIT License (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 3,992 days since the last release |
| First released | |
| Downloads | 1,344,853/month — #4,025 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: Parsley-1.3-py2.py3-none-any.whl
Tags
More Text Processing packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyparsingpyparsing provides a library for building text…
permissive · top 1,000 on PyPI
docutilsDocutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
RapidFuzzRapidFuzz provides fast fuzzy string matching…
permissive · top 1,000 on PyPI
tinycss2tinycss2 parses CSS strings into token and…
permissive · top 1,000 on PyPI
llama-parseLlamaParse parses complex documents (PDFs,…
permissive · top 1,000 on PyPI
PyMeta3PyMeta3 compiles pattern-matching grammars…
permissive · top 15,000 on PyPI
pyPEG2pyPEG2 is a PEG (Parsing Expression Grammar)…
copyleft · top 15,000 on PyPI
parsimoniousParsimonious is a pure-Python PEG (parsing…
permissive · top 5,000 on PyPI
parsoParso is a Python parser that recovers from…
permissive · top 1,000 on PyPI
rplyRPLY is a pure Python parser generator that…
permissive · top 15,000 on PyPI
mo-parsingmo-parsing is a PEG parser generator that lets…
permissive · top 15,000 on PyPI
TatSuTatSu compiles extended EBNF grammars into…
permissive · top 5,000 on PyPI
rule-engineRule Engine provides a lightweight, custom…
permissive · top 15,000 on PyPI
parsyParsy is a parser combinator library that lets…
permissive · top 5,000 on PyPI
plyPLY is a lexer and parser generator for Python…
permissive · top 1,000 on PyPI