Skip to main content

emit_peggy

Function emit_peggy 

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

Emits Peggy PEG grammar text from the grammar IR.

Peggy maps directly to the IR’s PEG-oriented expression algebra: ordered choice uses /, sequences are whitespace-separated, predicates use & and !, labels use label:expr, and counted repetitions use Peggy’s expr|min..max| form.

§Errors

Returns GrammarEmitError when the IR contains an internal invariant that cannot form valid Peggy text, such as an empty choice, an empty character class, a descending character range, or counted repetition with max < min.