Python bindings for bison/flex parser engine
Project description
PyBison
Welcome to PyBison!
Bringing GNU Bison/Flex's raw speed and power to Python
What is PyBison?
PyBison is a framework which effectively 'wraps' Bison and Flex into a Python class structure.
You define a parser class, define tokens and precedences as attributes, and parse targets as methods with rules in the docstrings, then instantiate and run.
Black Magick happens in the background, whereupon you get callbacks each time yyparse()
resolves a parse target.
Install
Now, install pybison with:
pip install pybison
The following command will verify if the installation succeeded:
python -c "import bison"
There are already parsers for Python. Why re-invent the wheel?
I looked at all the Python-based parsing frameworks.
IMO, the best one was PLY - a pure-python lexx/yacc implementation (which I have borrowed from heavily in designing PyBison's OO model).
But PLY suffers some major limitations:
- usage of 'named groups' regular expressions in the lexer creates a hard limit of 100 tokens - not enough to comfortably handle major languages
- pure-python implementation is a convenience, but incurs a cruel performance penalty
- the parser engine is SLR, not full LALR(1)
The other frameworks utilise a fiddly script syntax -
How do I use this?
Refer to the examples and the docs for usage.
Development
You will need:
We assume that Python, pip and a C compiler is already installed.
Dependencies
First, install the dependencies bison
and flex
.
Arch Linux
sudo pacman -S bison flex
Ubuntu
sudo apt-get install bison flex
Debugging
See the short introduction into debugging.
Collaborators
- PyBison was designed and written by David McNab david@freenet.org.nz
- smvv
- habibutsu
- thisiscam
- eugeneai
- csarn
- sbrodehl
- da-h
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
Hashes for pybison-0.4.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a3041e810b8a21ba2beb146fdfb0bf2fc3a34c341561ddd4db1f1ccbb49020e |
|
MD5 | 6328922c69a1b431e6ddafc04a89fa88 |
|
BLAKE2b-256 | 271d011f76737f34ee5f364cd318d5287f491971a46339898ee92c4d1dd766c7 |
Hashes for pybison-0.4.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1a228df5e93688a34eacc9a127abc7de023f32141c2b314691f45bfe8c38db8 |
|
MD5 | c2acdbc0745fd380f1edea0928348a98 |
|
BLAKE2b-256 | f06a2495a6648179133a6f21f3bb44002455468a55120b14cc802d0c62e65d99 |
Hashes for pybison-0.4.1-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e56217e5975d36b4c29e43410474faea59bc77f60aa6d3865e87f748db850ef3 |
|
MD5 | fce6761a732d9756e24afc9de202139a |
|
BLAKE2b-256 | da3129e85d0a287ce281d49fdd79afe846e9d1429add3360ee0c5e7bbfdee40a |
Hashes for pybison-0.4.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2073a92f3d3d611c1c785b34c806523b012ee658a716ddfdbf38091fd85c32a8 |
|
MD5 | f0566467cc8d46ada636ec59a01d0dd7 |
|
BLAKE2b-256 | 456b1ff43a71043dd5aeea14b35344246af9114e86c04f308cde87951590457f |
Hashes for pybison-0.4.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56fe2ce5b5fd7bf9fdbb604e1326c65474d63b347d3f5b3e914a2e8000312b51 |
|
MD5 | 9275b53818ec89ad4b65013bdb1bdb8e |
|
BLAKE2b-256 | 4db2afd3604ddc73a81bc5cbfcdc684ac09766f10b974047ac08704750a08c73 |
Hashes for pybison-0.4.1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 965f16df92348d045506ec1d6a247aac989de91dc34fbba67076e9dea8587acc |
|
MD5 | 5c30899116f8610ab83a689106297923 |
|
BLAKE2b-256 | 0d5eaf8a3f359b58677c1319cc6e5a1a4137dc990ab63d43885ab4ad0bc2f319 |
Hashes for pybison-0.4.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 330d1a56b89d9ef83e7dda3c7357802ffada48cc4ab4573a896e53059f36e8df |
|
MD5 | e90d73a49073d131a860dd492ad15b8b |
|
BLAKE2b-256 | 1e99bbbc0316dd4e46763269a4e5b41de02a416d4d2529276a1fd31e058a376a |
Hashes for pybison-0.4.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e6eec45611d9e2107a9685bb434bf90f336f6d4ae550a9236534547aa50f890 |
|
MD5 | c8871200dee550562b69b46d5b9fdacb |
|
BLAKE2b-256 | 18f9075392af313fd89c7fc82f768fb697db7cf7b05f38b6e2af0785105c81dd |
Hashes for pybison-0.4.1-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e07dbbd500dcf55219c95c99137e2d778db2d2d6ab686d351cccebdb8ce39765 |
|
MD5 | 7388742f9596e0b47722c16c75c0cf32 |
|
BLAKE2b-256 | 43693948beda12aade00ee71dffe8020742d944a64adbe134dffcb18317ea31d |
Hashes for pybison-0.4.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e502d5c5d306493c9b5517709728b1580f1303533f83a4c79aede36c1d7c635f |
|
MD5 | 30d886273f69fb1a1483e4d0dd3c0471 |
|
BLAKE2b-256 | 399fd846f53fd48385dd01aa04f9309faeaa394487f56b9a3eb29ae03e933864 |
Hashes for pybison-0.4.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94868188585b80c271436bbcc1beaa933fcbf1a53f75da86983bcd909d09507d |
|
MD5 | 60e244cf4644008d825aa2849e20784b |
|
BLAKE2b-256 | eabb40646f77f310439accfe0cbddcb2f04583e306d50e407ab049d285fbceff |
Hashes for pybison-0.4.1-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 110b7ae02104ffe15ff949c862c5a3896ecf388416f97677e5ea43c44596fd4e |
|
MD5 | 57e750f294ad78b3c9258ac4fb78c6cb |
|
BLAKE2b-256 | 748b61a51512f27e512a0d4f6cbc201d7587550e4530f164099250b70013d8c2 |