antlr-rust-codegen
Rust library and antlr4-rust-gen command for compiling ANTLR v4 grammars
into source compatible with antlr-rust-runtime.
Use it from a build script:
# x-release-please-start-version
[]
= "0.29.0"
[]
= "0.29.0"
# x-release-please-end
Successful generations expose structured compiler warnings through
Generation::diagnostics(), including the diagnostic code, severity, source
path, and exact UTF-8 byte span. Generation::warnings() retains the rendered
CLI messages.
Or install the command:
The runtime, codegen, and internal parser packages are released in lockstep.
Internal module ownership
src/grammar/semantics.rs is the documented exception to the 2,000-line
production-module guideline. Its semantic pass deliberately keeps vocabulary
numbering, symbol diagnostics, action binding, and the resulting
SemanticBindings mutation in one owner because they share source-coordinate
and declaration-order invariants. The independently mutable grammar
integration, validation, transform registry, transform analyses, and transform
passes are separate modules; splitting this remaining pass would expose its
partially built vocabulary and binding state as a wider internal contract
without creating an independent optimization or rendering boundary.