Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use C++ parser via speedy-antlr-tool #70

Closed
wants to merge 12 commits into from
Closed

Use C++ parser via speedy-antlr-tool #70

wants to merge 12 commits into from

Conversation

g5t
Copy link
Collaborator

@g5t g5t commented Sep 21, 2024

The antlr4 C++ runtime parser is supposedly faster than the Python runtime one.

This PR changes the layout of the repository, and adds the source files of the antlr4 C++ runtime.

Both C++ and Python generated file sources are now outside of the distributed module directories, and are only regenerated by manually triggering the src/grammar/build.py script.

The C++ parsers are wrapped for Python via speedy-antlr-tool and added into the build via a new setup.py defining the binary modules.
The new parsers do not expose all antlr4 features, e.g., the named context elements are present in the C++ sources and the Python implementation, but the automatic wrapping does not expose them. Fortunately, all use-cases in the mccode-antlr visitors could be changed to use the functional forms like ctx.paramsctx.expr().

The build system is augmented to use CIBuildwheel for Python 3.8-3.13 on Linux (manylinux and musllinux), macOS (Arm and Intel) and Windows.

@g5t
Copy link
Collaborator Author

g5t commented Sep 23, 2024

At the moment, binary parsers are not measurably faster than the Python implementation from antlr4, and are not worth the extra build and maintenance efforts.

It may be worth returning to this in the future, however.

@g5t g5t closed this Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant