Skip to main content

buildstatus Supported Python Versions

packagestatus

An Earley Algorithm Parser toolkit.

This package uses Jay Earley’s algorithm for parsing context-free grammars, and comes with some generic Abstract Syntax Tree routines. There is also a prototype scanner that does its job by combining Python regular expressions.

(SPARK stands for Scanning, Parsing, and Rewriting Kit. It is a poor name since it conflicts with a more popular package of the same name. In the future we will rename this.)

The original version of this was written by John Aycock for his Ph.d thesis and was described in his 1998 paper: “Compiling Little Languages in Python” at the 7th International Python Conference. The current incarnation of this code is maintained (or not) by Rocky Bernstein.

Note: Earley algorithm parsers are almost linear when given an LR grammar. These are grammars that are left-recursive.

Installation

This package is available from PyPI:

easy_install spark-parser

However if you want to install from the github source:

$ setup.py install       # creates wheel and install

To run from the source tree:

$ setup.py develop

Features

Many of the added features are directly related to using it in the Python decompiler uncompyle6.

One unique feature of this code is the ability to have it profile which grammar rules have been used over a series of parses. This can inform which grammar rules are not needed.

Another unusual feature is to be able to remove grammar rules after a rule has been added. This is used in uncompyle6 where grammar rules inherited from one version of Python to another.

The non-standard grammar generator system feature is the ability to perform a callback check just before a reduction rule occurs. This allows for checking a token stream or partial parse tree by means other than through the grammar language.

NEW-FEATURES describes these features and others in more detail.

Example

The github example directory has worked-out examples; The PyPI package uncompyle6 uses this and contains a much larger example.

Support of older versions of Python

We support running this from older versions of Python in various git branches:

  • python-2.4-to-2.7 has code for Python 2.4 to 2.7

  • python-3.0-to-3.2 has code for Python 3.0 to 3.2

  • python-3.3-to-3.5 has code for Python 3.3 to 3.5

  • python-3.6-to-3.10 has code for Python 3.6 to 3.10

  • master has code for Python 3.11 to the current version of Python

See Also

Release files for spark-parser 1.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spark-parser 1.9.0
File Size Uploaded
spark_parser-1.9.0.tar.gz 80.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for spark-parser 1.9.0
File
spark_parser-1.9.0-py313-none-any.whl Python 3.13 none any Details
spark_parser-1.9.0-py312-none-any.whl Python 3.12 none any Details
spark_parser-1.9.0-py311-none-any.whl Python 3.11 none any Details
spark_parser-1.9.0-py310-none-any.whl Python 3.10 none any Details
spark_parser-1.9.0-py2-none-any.whl Python 2 none any Details

Total release size: 361.8 kB

Release files / spark_parser-1.9.0.tar.gz

Download URL spark_parser-1.9.0.tar.gz
Size 80.1 kB
Tags Source
SHA-256 checksum
How to use checksums
dc66d48c4265c4133db41a9c5fe9c1c502b3b20167df158a0f234cd31712cf64
BLAKE2b-256 checksum
How to use checksums
3ce1a443990c6c32cb7fa7d3896405d2924c4921c74c1ffd5b90ffaeb42f778a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / spark_parser-1.9.0-py313-none-any.whl

Download URL spark_parser-1.9.0-py313-none-any.whl
Size 63.4 kB
Tags Python 3.13
SHA-256 checksum
How to use checksums
fc2e188601a6c8f7a68e2d7bd97ca377f6dc271a67607ff11e6beef39d0e9d1d
BLAKE2b-256 checksum
How to use checksums
1c3d074fef587d8c392e4e5d3599670fec88e01ebb5a5ddc1ada05b80f01a921
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.13.0

Release files / spark_parser-1.9.0-py312-none-any.whl

Download URL spark_parser-1.9.0-py312-none-any.whl
Size 63.4 kB
Tags Python 3.12
SHA-256 checksum
How to use checksums
036b8227c5b09a919a7eae50576f91d533124de1dbf9a9c654a2be5864f1c947
BLAKE2b-256 checksum
How to use checksums
f19f771e5add2467b6cadbcb560290bb6d9a4b069c3ca8483181245f5ea2d83e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / spark_parser-1.9.0-py311-none-any.whl

Download URL spark_parser-1.9.0-py311-none-any.whl
Size 63.4 kB
Tags Python 3.11
SHA-256 checksum
How to use checksums
30ab1a6005a783ca39f73ad477efb1e12a1cb0123607543e71690d9fd6fecf49
BLAKE2b-256 checksum
How to use checksums
4bbba13ae1bd3d257720e19d5d8a3dfa34cee38c5d9dd59dcb2c001bd0c6c310
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / spark_parser-1.9.0-py310-none-any.whl

Download URL spark_parser-1.9.0-py310-none-any.whl
Size 46.0 kB
Tags Python 3.10
SHA-256 checksum
How to use checksums
a1ab71c2df145b21c2c1c8aa5f001e36206bec259ec836504263ab7450881ad1
BLAKE2b-256 checksum
How to use checksums
d8c69d34faf67c92e14f1feaa036f6bc8beed0af71af1287060060af1b47bf9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / spark_parser-1.9.0-py2-none-any.whl

Download URL spark_parser-1.9.0-py2-none-any.whl
Size 45.5 kB
Tags Python 2
SHA-256 checksum
How to use checksums
fb17b1dc56de2d2554ae2c95705b2a5940a04b3a0aa43dcdf2fd609ad3edbf22
BLAKE2b-256 checksum
How to use checksums
32499ffca7bd17648e6bcc3371960abf4aaf53e5fe1249bdef9bc8c7ae23fd9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release history Release notifications | RSS feed

This release

1.9.0 This release

6 release files

1.8.9

7 release files

1.8.8

3 release files

1.8.7

9 release files

1.8.6

10 release files

1.8.5

12 release files

1.8.4

9 release files

1.8.3

9 release files

1.8.2

9 release files

1.8.1

9 release files

1.8.0

9 release files

1.7.2

9 release files

1.7.1

10 release files

1.7.0

10 release files

1.6.1

9 release files

1.5.2

11 release files

1.5.1

11 release files

1.5.0

11 release files

1.4.3

12 release files

1.4.2

10 release files

1.4.0

5 release files

1.3.0

6 release files

1.2.1

6 release files

1.1.1

6 release files

1.1.0

6 release files

1.0.2

6 release files

1.0.1

6 release files

1.0.0

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page