Skip to main content

A monadic parser combinator written purely in python

Project description

parsemon2

This is yet another attempt to bring monadic parsing to python. The problem the author saw with many other implementations is a limit to their composability. A lot of the times these otherwise quite well written implementations suffer pretty bad from pythons lack of TCO. This implementation uses trampolines to get around that.

Right now this implementation is nothing more but a toy, but the tests that come with this package show already that it’s parsing ability is not dependent on pythons recursion limit.

We also have error messages.

building the package

Building the package from source can be done in multiple ways.

building from sdist

You need to have the rust toolchain installed. Check out your GNU/Linux distribution to learn how to install it. Another handy resource to consider is https://www.rust-lang.org/tools/install.

Now you can build the package from source via pip:

pip install setuptools_rust wheel
pip wheel parsemon2 --no-binary :all:

Now you should have a wheel for your platform in your working directory.

build from the repository

The easiest way to build wheels from the git repository is to use docker since there is a handy build script included in the repo. Make sure the your user has access to docker. Consult the documentation of your system for more information on how to install docker.

With docker installed run the following in the root folder of the source code repository:

bin/build-wheels

After the program finishes you should find wheels for various python versions in the dist/ directory.

documentation

If you want to learn about the library we recommend checking out our readthedocs page.

Changes

3.1.0

  • Serious peformance improvements were made

  • Minor bug fix in json example parser

3.0.1

  • Update README

3.0

  • Remove pyrsistent deque implementation

  • Improve fmap performance

  • Implement end-of-input parser

  • run_parser now returns a ParsingResult object instead of the raw value of the supplied parser

  • run_parser won’t fail if the parser did not consume all of the supplied input

  • Got rid of NotEnouhInput exception.

  • Drop official support for Python 3.6

  • Change semantics of until parser.

2.0

  • Parsers constructed with do can now take arguments

  • New parser for floating point numbers: parsmon.basic.floating_point

  • Implement x | y operator for parsers, it is a short hand for choice(x,y)

  • Improved performance parsing speed by factor 4 - 6

  • There is now an example of a parser included in this package. It is the worlds slowest json parser

1.1

  • Implement validators

  • chain now accepts 1 or more arguments

  • Implement do notation

  • New whitespace parser

  • New parser for integers

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

parsemon2-3.1.1.tar.gz (33.8 kB view details)

Uploaded Source

Built Distributions

parsemon2-3.1.1-cp39-cp39-manylinux_2_24_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.24+ x86-64

parsemon2-3.1.1-cp38-cp38-manylinux_2_24_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.24+ x86-64

parsemon2-3.1.1-cp38-cp38-manylinux2014_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.8

parsemon2-3.1.1-cp37-cp37m-manylinux_2_24_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.24+ x86-64

parsemon2-3.1.1-cp36-cp36m-manylinux_2_24_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.6m manylinux: glibc 2.24+ x86-64

File details

Details for the file parsemon2-3.1.1.tar.gz.

File metadata

  • Download URL: parsemon2-3.1.1.tar.gz
  • Upload date:
  • Size: 33.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.1.post0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.7

File hashes

Hashes for parsemon2-3.1.1.tar.gz
Algorithm Hash digest
SHA256 3754c4e6fdddc947d0a8c5075f6a666be1501523cf5dc6b6769de1e7f7e062ad
MD5 331d29b69427d3ba85bffafa3126f07c
BLAKE2b-256 2f674162bcfa0a245eb2180244b433ff617c5a8754db4a8fe7e142b5e98ea690

See more details on using hashes here.

File details

Details for the file parsemon2-3.1.1-cp39-cp39-manylinux_2_24_x86_64.whl.

File metadata

  • Download URL: parsemon2-3.1.1-cp39-cp39-manylinux_2_24_x86_64.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: CPython 3.9, manylinux: glibc 2.24+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.1.post0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.7

File hashes

Hashes for parsemon2-3.1.1-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 24dcb31490fe36c9dc3fbefa320a2cf19d296c670f1e015ae29c79be977435e9
MD5 f894506961d2ed3972c08745555eb86a
BLAKE2b-256 b84023638b7c2547b3d594d6f58797b86823ef03e3681df661ebf2d6c22cf13a

See more details on using hashes here.

File details

Details for the file parsemon2-3.1.1-cp38-cp38-manylinux_2_24_x86_64.whl.

File metadata

  • Download URL: parsemon2-3.1.1-cp38-cp38-manylinux_2_24_x86_64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.8, manylinux: glibc 2.24+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.1.post0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.7

File hashes

Hashes for parsemon2-3.1.1-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 9cb6ab526ed3a4bba997f4fcc8f78b079c9008fbafd69d823dc2e67b37c45352
MD5 6bf6d3e65170fef8c141a41d4c3051d5
BLAKE2b-256 6b5026164604e9da60ce396ca0d4d49b4ae77c568b3180d4562c26eadd92508b

See more details on using hashes here.

File details

Details for the file parsemon2-3.1.1-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

  • Download URL: parsemon2-3.1.1-cp38-cp38-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.1.post0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.7

File hashes

Hashes for parsemon2-3.1.1-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5d62a07f0305b062a651c0bfa5d83549f25960ec9f3810959d6c3721ef2095c6
MD5 38a99136048cad2a8939440b03ee3511
BLAKE2b-256 17cd441d260c0b5112239b6a6f732ea7c47c1528ea21997e5ba1fe9182bce998

See more details on using hashes here.

File details

Details for the file parsemon2-3.1.1-cp37-cp37m-manylinux_2_24_x86_64.whl.

File metadata

  • Download URL: parsemon2-3.1.1-cp37-cp37m-manylinux_2_24_x86_64.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: CPython 3.7m, manylinux: glibc 2.24+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.1.post0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.7

File hashes

Hashes for parsemon2-3.1.1-cp37-cp37m-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 3cd1a6c11e635769382ab34c416d96f728540017cb0f9e2334b07251b90c8bc1
MD5 5df09960cddf30d2a63119f3ed9b3bfd
BLAKE2b-256 0a92c3d7f3a6e518e5c7b7b26d5c9aa57cfc3c6987e90fe3040539798ae8599d

See more details on using hashes here.

File details

Details for the file parsemon2-3.1.1-cp36-cp36m-manylinux_2_24_x86_64.whl.

File metadata

  • Download URL: parsemon2-3.1.1-cp36-cp36m-manylinux_2_24_x86_64.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: CPython 3.6m, manylinux: glibc 2.24+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.1.post0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.7

File hashes

Hashes for parsemon2-3.1.1-cp36-cp36m-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 7738e4e080b8d6e8cb0b0ed456b1b07f640eb0b89d909ce10dda8f4de38e6baa
MD5 1eca4dbb9f987a6e39985bfecad75e1e
BLAKE2b-256 d3b4bbf8a577b4f36dc06245ee2defb8fbcbce046a279caac1f7008b2ffaa388

See more details on using hashes here.

Supported by

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