Skip to main content

emit_ebnf

Function emit_ebnf 

Source
pub fn emit_ebnf(
    grammar: &Grammar,
) -> Result<(String, EmitReport), GrammarEmitError>
Expand description

Emits ISO/IEC 14977-style Extended Backus-Naur Form text from the grammar IR.

EBNF has native optional and repetition operators, but ISO EBNF does not have character ranges or character classes, so those constructs are expanded through deterministic helper productions.

ยงErrors

Returns GrammarEmitError when the grammar contains a construct ISO EBNF cannot represent, such as PEG predicates, negated character classes, or a character range too large to expand safely.