Skip to main content

bootpeg – the bootstrapping PEG parser

Project description

Documentation Status Available on PyPI Unit Tests (master) Verification (master) Test Coverage

> Some people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now they have two problems.

bootpeg is a PEG parser for creating parsers – including itself. By default, it supports a modified EBNF with actions akin to PEP 617.

>>> # recreate the bootpeg parser from itself
>>> from bootpeg.api import import_parser, PikaActions
>>> from bootpeg.grammars import bpeg
>>> parse_bpeg = bpeg.parse
>>> for _ in range(5):
...     parse_bpeg = import_parser(
...         bpeg.__name__, actions=PikaActions, dialect=parse_bpeg
...     )

Unlike most other Python PEG parsers which are top-down parsers, bootpeg provides a bottom-up Pika parser: it handles left-recursive grammars natively, allows recovering partial parse results, and is guaranteed to run in linear time. Like any PEG parser, bootpeg automatically creates unambiguous grammars, supports infinite lookahead, and allows to express grammars comfortably.

  • Native support for left-recursion and left-associativity.

  • Builtin error reporting covering multiple failures.

  • Automatic parser generation from a multitude of meta-grammars.

This makes it straightforward to implement your own custom grammars without worrying about their implementation. To get started using or contributing to bootpeg, head straight to the bootpeg documentation.

Do I need a bigger boot?

> Some people, when confronted with a problem, think “I know, I’ll use self-writing parsers.” Now they have recursive problems.

If you need a battle-hardened, production ready parser suite then pyparsing should be your first choice. If you are the choosy type, make it your second choice as well.

Pick bootpeg when you need safe left-recursion and self-parsing. It will never bite off your left peg via infinite recursion. It will take care of itself and all its grammars to make you happy. bootpeg is the friend you need when you know bootpeg is the friend you need.

Well, eventually it will be; bootpeg is still a cute little puppy. Don’t let it lift too heavy. So far it is only lifting itself.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bootpeg-0.6.0.tar.gz (32.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bootpeg-0.6.0-py2.py3-none-any.whl (22.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file bootpeg-0.6.0.tar.gz.

File metadata

  • Download URL: bootpeg-0.6.0.tar.gz
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.25.1

File hashes

Hashes for bootpeg-0.6.0.tar.gz
Algorithm Hash digest
SHA256 ce56051be89b6d283f38eeb15a4d1f3df0036f02c58032d111916fda57bf4d0f
MD5 256eda4d19a1641307780162c4b85e83
BLAKE2b-256 80daf6bd1652de0c909e7bf5591c6281c8964c479042c86025da0ddef64db8be

See more details on using hashes here.

File details

Details for the file bootpeg-0.6.0-py2.py3-none-any.whl.

File metadata

  • Download URL: bootpeg-0.6.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.25.1

File hashes

Hashes for bootpeg-0.6.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 27e7e16ebf8d5feb85014d26d3c22f09bae2fd18aa08a7a4e8911ef99f9c39aa
MD5 19343eb9232bad81d4787cc2bb146736
BLAKE2b-256 b60570a0aef4e80dec3c05e07b4e6d6340602db6ffb42905bd85ab89f93de0ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page