Skip to content

xonsh/peg-parser

Repository files navigation

xonsh-parser

Xonsh parser using CPython's PEGen grammar

build codecov PyPI version


Documentation: https://jnoortheen.github.io/xonsh-parser/

Source Code: https://github.com/jnoortheen/xonsh-parser

Benchmarks: https://xonsh.github.io/peg-parser/dev/bench/


Development

Setup environment

  • You can use any PEP-621 supported tools like PDM, Hatch ... to manage the development environment and production build.
# install development deps
pip install -e ".[dev,test,docs]"
# setup linters,formatters etc.,
pre-commit install
  • We use Taskfile to manage development tasks.
task test

# to watch for changes and run tests
task test --watch -- -x --ff

# release a new version
task release

Workflow

  1. Explore the PEG grammar notations from the following pages
    a. https://we-like-parsers.github.io/pegen/
    b. https://devguide.python.org/internals/parser/
  2. Edit the xonsh.gram while adding any new actions to subheader.py
  3. Test the new changes with task test as the parser.py will get autogenerated
  4. You can force regeneration with task generate -f

License

This project is licensed under the terms of the MIT license.

Credits