compile-grammar
Run native ANTLR4 compilation checks to catch grammar syntax and tooling errors, providing diagnostics with line/column, timing, and generated artifacts.
Instructions
Run native ANTLR4 compilation checks for grammar syntax/tooling errors.
When to use: Before committing grammar edits, after refactors, or when validate-grammar looks clean but ANTLR toolchain still fails.
Supports:
ANTLR4 native diagnostics (error/warning with line/column)
Multi-file imports/tokenVocab with load_imports=true and from_file
Compile timing and generated file summary
Example usage: from_file: "MyGrammar.g4" load_imports: true
Returns: compile success/failure, native diagnostics, timing, generated artifacts.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| base_path | No | Optional: base directory for resolving imports/tokenVocab. Defaults to from_file directory. | |
| from_file | No | Optional: path to grammar file to compile (recommended for import-aware checks) | |
| load_imports | No | Optional: if true, loads imported grammars and tokenVocab grammars before compile. Default: true. | |
| grammar_content | No | The ANTLR4 grammar content (optional when from_file is provided) |