skillfed

spark-parser

An Earley-Algorithm Context-free grammar Parser Toolkit

spark-parser v1.9.0 513.2K downloads/30d#6,249 on PyPI53
Permissive license MIT DORMANT released

What it is and what it does

spark-parser provides a toolkit for building parsers using Jay Earley's algorithm, which handles context-free grammars efficiently, especially left-recursive ones. It includes utilities for constructing Abstract Syntax Trees and a scanner built from Python regular expressions. The package originated from academic work (Aycock's 1998 paper) and has been maintained for practical use in projects like decompilers and code analysis tools.

The package supports a wide range of Python versions from 2.4 through 3.12 via separate git branches and wheels. It offers specialized features like grammar rule profiling to identify unused rules, the ability to remove rules after addition, and callback checks before reduction rules—capabilities designed for dynamic grammar manipulation in decompilers and code analysis tools.

Use it for:

  • Building a decompiler or bytecode analyzer that needs to parse and reconstruct code structures.
  • Implementing a domain-specific language (DSL) parser where you control the grammar and need AST generation.
  • Profiling and optimizing grammar rules by tracking which rules are actually used across many parses.
  • Parsing configuration files or markup formats defined by context-free grammars.

Worth the install?

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

Implements an Earley algorithm parser for context-free grammars with Abstract Syntax Tree support and a regex-based scanner.

Yes, if you need an Earley parser for context-free grammars and can tolerate dormant maintenance. The package is stable (Production/Stable status), has no known vulnerabilities, installs easily, and works across modern Python versions. Most suitable for specialized use cases like decompilation or DSL parsing where its grammar manipulation features add value. Not recommended if you need active maintenance or support.

Install

spark-parser on PyPI

pip

pip install spark-parser

uv

uv add spark-parser

poetry

poetry add spark-parser

Installing spark-parser

Before you install

Low friction installation with wheels for Python 2.7 through 3.12. Maintenance is dormant (675 days since last release), though the repository remains active with a recent commit in December 2024.

License in practice

MIT license permits unrestricted use, modification, and distribution with minimal restrictions.

Quickstart

pip install spark-parser

from spark_parser import GenericParser, GenericScanner

class MyParser(GenericParser):
    def __init__(self):
        GenericParser.__init__(self)
        # Define grammar rules here

parser = MyParser()
result = parser.parse(tokens)

Verify before relying

  • Whether the package's dormant maintenance status affects compatibility with Python versions beyond those explicitly listed in classifiers.
  • Performance characteristics when parsing large or deeply nested grammars compared to other Earley implementations.

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance dormant — 675 days since the last release
Last repo commit
First released
Downloads 513,194/month — #6,249 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: spark_parser-1.9.0-py2-none-any.whl; spark_parser-1.9.0-py310-none-any.whl; spark_parser-1.9.0-py311-none-any.whl; spark_parser-1.9.0-py312-none-any.whl; spark_parser-1.9.0-py313-none-any.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2.4Programming Language :: Python :: 2.5Programming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: 3.0Programming Language :: Python :: 3.1Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.2Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Code GeneratorsTopic :: Software Development :: Libraries :: Python Modules

Tags

earley algorithm parsercontext-free grammar parsingpython parser toolkitast generationgrammar-based parsing
parsinggrammarearley-algorithm

More Python Modules packages