skillfed

Parsley

Parsing and pattern matching made easy.

parsley v1.3 1.3M downloads/30d#4,025 on PyPI
Permissive license MIT License Abandoned released

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 parsley

uv

uv add parsley

poetry

poetry add parsley

Installing 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

PEG parser generatorpattern matching languagegrammar parsing libraryOMeta implementationreadable parser DSLtext parsing without yaccdeclarative grammar rules
parser-generatorpeg-parsingabandoned

More Text Processing packages