Skip to main content

import_antlr

Function import_antlr 

Source
pub fn import_antlr(text: &str) -> Result<Grammar, GrammarImportError>
Expand description

Parses ANTLR v4 .g4 grammar text into the grammar IR.

The importer is a clean-room parser for the structural ANTLR grammar subset needed by the grammar IR. ANTLR alternatives are lowered as unordered CFG choices, while lexer commands and dropped target-language actions are preserved in rule documentation.

ยงErrors

Returns GrammarImportError when the source cannot be parsed as the supported ANTLR subset or when a parsed prelude construct is recognized but not yet representable.