EBNF Compiler is a compiler for the EBNF (Extended Backus-Naur Form) notation. This project was developed as part of the "Compiler Construction" course at HEIA-FR, Switzerland.
📝 Access the documentation online: https://maiscommentz.github.io/ebnf-compiler/
- Lexical Analysis (Scanner): Tokenizes EBNF grammars into meaningful symbols.
- Syntax Analysis (Parser): Validates grammars against standard EBNF rules.
- Modern Python Architecture: Built with Python 3.12+, fully typed using
pyrightandmypy. - Command-Line Interface: Easy-to-use CLI built with Typer and Rich.
.
├── .github/workflows/ # GitHub Actions CI/CD pipelines
├── docs/ # Sphinx documentation (deployed to GH Pages)
├── LICENSES/ # SPDX License files (MIT)
├── src/ebnf_compiler/ # Core compiler source code
├── tests/ # Pytest test suite
├── examples/ # Example EBNF grammar files
├── .gitignore # Git ignore files
├── .pre-commit-config.yaml # Pre-commit configuration
├── .python-version # Python version file
├── pyproject.toml # Python build & dependency configuration (uv)
├── README.md # This file
└── REUSE.toml # REUSE specification
This project uses uv as its modern and ultra-fast Python package manager.
- Python 3.12 or higher
- uv
-
Clone the repository:
git clone https://github.com/maiscommentz/ebnf-compiler.git cd ebnf-compiler -
Install dependencies:
uv sync
Once the environment is synced, you can use the EBNF compiler via its CLI:
uv run ebnf-compiler --helpYou can point the compiler to a grammar file (like those in the examples/ directory):
uv run ebnf-compiler examples/basic.ebnfWe encourage high code quality standards. This project enforces styling and typing checks using pre-commit.
Execute the automated test suite using pytest:
uv run pytestEnsure your code meets the quality standards (Black, Ruff, Pyright, MyPy) by running pre-commit:
uv run pre-commit run --all-filesTo compile the Sphinx documentation locally:
cd docs
uv run make htmlThe built pages will be available in docs/_build/html/.
The repository relies on a complete GitHub Actions pipeline configured in .github/workflows/workflow.yml. It automatically handles:
- Validation: Enforces
pre-commit(formatting, linting, type-checking). - Testing: Runs the
pytestsuite across the codebase automatically. - Documentation: Builds the Sphinx docs and deploys them directly to GitHub Pages (on the main branch).
- Releases: Builds Python distribution packages when a new GitHub Release is published.
This project complies with the REUSE specification.
The source code is licensed under the MIT License. See the LICENSES/MIT.txt file for more details.
© 2026 Filipe Casimiro Ferreira pro.maiscommentz@gmail.com