Function compile_grammar
pub fn compile_grammar(
source: &str,
options: CompileOptions<'_>,
) -> Result<CompiledGrammar, GrammarError>Expand description
Compile .lark source. from_lark_source-style construction also routes
through here.
The pipeline mirrors Lark.__init__’s build path:
build_grammar (Definition-level: meta-parse → walk → %import/override →
resolve_term_references → validate) → Grammar.compile
(terminals → rules EBNF→BNF → dedup → unused-prune)
→ the ordered tail edit_terminals → priority='invert'/None transform →
build_rule_shape + build_lalr. The output CompiledGrammar is the same
downstream shape json_loader::LoadedGrammar emits, so every proven
lexer/parser stage is shared.