kebnf
Convert OMG KeBNF grammar specifications to parser grammars. Parses the full KerML + SysML v2 KeBNF specs and emits target-specific output with semantic traceability.
Output Formats
| Format | Flag | Output | Status | |--------|------|--------|--------| | ANTLR4 | --format antlr4 | .g4 | CI-validated -- compiles with antlr4, javac | | tree-sitter | --format tree-sitter | grammar.js | CI-validated -- tested against tree-sitter-sysml corpus |
Quickstart
# Install from crates.io
cargo install nomograph-kebnf
# Convert SysML v2 KeBNF to ANTLR4 grammar
kebnf KerML.kebnf SysML.kebnf --format antlr4 -o Sysml.g4
# Fetch the latest specs from the OMG GitHub repo, then convert
kebnf --fetch-spec
kebnf ~/.cache/kebnf/*.kebnf --format antlr4 -o Sysml.g4To build from source instead:
cargo build --release
./target/release/kebnf --helpGetting the .g4 File
The CI pipeline generates and validates Sysml.g4 on every commit. Download it from the latest pipeline:
Pipeline antlr4-validate job Artifacts Sysml.g4
Or browse: latest pipeline artifacts
CI Validation
Every push runs a five-stage validation:
- rust-build -- zero compiler warnings
- rust-test -- all tests pass
- rust-clippy -- zero lint warnings
- antlr4-validate -- generate .g4 from full KerML+SysML, compile with
antlr4 4.13.2 (zero errors), compile generated Java with javac 21
- tree-sitter-validate -- generate grammar.js from full KerML+SysML,
run tree-sitter generate (valid parser.c produced)