Skip to main content

emit_bnf

Function emit_bnf 

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

Emits classic Backus-Naur Form text from the grammar IR.

BNF has no native grouping, optional, repetition, character range, or character class operators, so this emitter synthesizes deterministic helper productions when a faithful expansion is possible.

ยงErrors

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