Skip to main content

A monadic parsing toolset for 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.

There is a (tested!) example implementation of a json parser included in the package. See src/parsemon/json.py for more information.

installation

This package should be available as a manylinux_2_24_x86_64 wheel on pypi. On a update to date linux machine pip should do the job just fine:

pip install parsemon2

Currently MS Windows and macOS are not supported.

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.2.0

  • Slight performance improvements

  • Implement repeat combinator that tries to run a parser for a specified number of times

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.2.0.tar.gz (32.0 kB view details)

Uploaded Source

Built Distributions

parsemon2-3.2.0-cp39-cp39-manylinux_2_24_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.24+ x86-64

parsemon2-3.2.0-cp38-cp38-manylinux_2_24_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.24+ x86-64

parsemon2-3.2.0-cp37-cp37m-manylinux_2_24_x86_64.whl (1.4 MB view details)

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

parsemon2-3.2.0-cp36-cp36m-manylinux_2_24_x86_64.whl (1.4 MB view details)

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

File details

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

File metadata

  • Download URL: parsemon2-3.2.0.tar.gz
  • Upload date:
  • Size: 32.0 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.2.0.tar.gz
Algorithm Hash digest
SHA256 2b9296c0e4122e0e1b39de960f50712d82d3afd5a8fc23a8f1d58702ff069bd9
MD5 d21a13bcb1facde3b1f7d441456d3152
BLAKE2b-256 ef20f5c86f709dd5e0b5d50d63aa7b0e4b04aa398b41ce0c35a2b79ed01054d7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: parsemon2-3.2.0-cp39-cp39-manylinux_2_24_x86_64.whl
  • Upload date:
  • Size: 1.4 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.2.0-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 6df3870df57ec3751eceb8ad8d4c96d3a37f82c3298876d1234643d8cf9f1804
MD5 9b6f08d30ee9a7575bfaf131b84210a1
BLAKE2b-256 b8a92151126423a72ea9291bb70a8e64b2b65b00ff09f59d793ffe1042cc1b8d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: parsemon2-3.2.0-cp38-cp38-manylinux_2_24_x86_64.whl
  • Upload date:
  • Size: 1.1 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.2.0-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 d6068b19988ac646b3ec9b203b342f788c4614ea383537bf4e46e7e5a4513958
MD5 7045aa0b2a2ea4b4287671ab46edae69
BLAKE2b-256 331a3a5a083af312388388394fcc1d2cce10b900164d7552c07f1dd790bad766

See more details on using hashes here.

File details

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

File metadata

  • Download URL: parsemon2-3.2.0-cp37-cp37m-manylinux_2_24_x86_64.whl
  • Upload date:
  • Size: 1.4 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.2.0-cp37-cp37m-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 69a5ee952f35999b5aaf1b2a26c7f79ffbce4d77a71482681fcef38e10e2e10c
MD5 1f37601140c569a2f6a754b7bb1847a4
BLAKE2b-256 c2249d441222e057b2c42e953d064b001ea0859febefb5de1f678c7dadb72a28

See more details on using hashes here.

File details

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

File metadata

  • Download URL: parsemon2-3.2.0-cp36-cp36m-manylinux_2_24_x86_64.whl
  • Upload date:
  • Size: 1.4 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.2.0-cp36-cp36m-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 a5705cfec1d6da936cc659049ed6c225637231f566a5d00e661e2d5e899b10c9
MD5 b8f71d29919afadb7bd17db6d28617c3
BLAKE2b-256 8b97e914c4a9ee52ea21831d90fc57c6a5112f3ef74ce5152e9983736b2ef45f

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