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.1
Fixed minor bug in error handling code
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file parsemon2-3.2.1.tar.gz
.
File metadata
- Download URL: parsemon2-3.2.1.tar.gz
- Upload date:
- Size: 32.1 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | c72daa3eb116875d76ca22bf9a1adf40bb28211dbe4d74ce8e5e0a456c1601e8 |
|
MD5 | 34f22172299fdab004210b5d68167f37 |
|
BLAKE2b-256 | c7539fe3090644b7afef319c000dd5da0aa79f74f539be1e14056255580c5ea2 |
File details
Details for the file parsemon2-3.2.1-cp39-cp39-manylinux_2_24_x86_64.whl
.
File metadata
- Download URL: parsemon2-3.2.1-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | fbd5aa350d267a6646379cce9c884b0561af5645261c2de809c0337067a6c6a9 |
|
MD5 | 0123454caf6df7888c1fe276eabaf190 |
|
BLAKE2b-256 | a4c9985c04dc06c808a3486d248aa996dc49d429a9ba794001d50d58ef216f27 |
File details
Details for the file parsemon2-3.2.1-cp38-cp38-manylinux_2_24_x86_64.whl
.
File metadata
- Download URL: parsemon2-3.2.1-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27c85ae8742f2807b75de402e60c0c1dd09fa378916ea66498d60b6f93cb66c1 |
|
MD5 | 8d8ca28359d5c994565189e983b4d808 |
|
BLAKE2b-256 | 61dcef03b3fb75ee3f3d880e069a66412438ba5fa7c54d42e4749751ae595b69 |
File details
Details for the file parsemon2-3.2.1-cp37-cp37m-manylinux_2_24_x86_64.whl
.
File metadata
- Download URL: parsemon2-3.2.1-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48b42980b3a8e6ad3c962c3cd1db172266886898e4a91b56267f35e494b30d88 |
|
MD5 | 745bd71911fa6f2703984d5dd3a1597c |
|
BLAKE2b-256 | c9f26fb6cc88c620f295d7ac0abecc186dd3a0d5615867a9a383269fc497110b |
File details
Details for the file parsemon2-3.2.1-cp36-cp36m-manylinux_2_24_x86_64.whl
.
File metadata
- Download URL: parsemon2-3.2.1-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf048c75ff0d18eeaea3baad83171b3f8085f2651f907b3c1d7188dee37d679b |
|
MD5 | 6021e22b2fd5200af3f87906cde60913 |
|
BLAKE2b-256 | 6cca2e8519e850e404669a405fc1db9a6ec9fdfa200022420df329a425d0e6e9 |