pub fn emit_pest(
grammar: &Grammar,
) -> Result<(String, EmitReport), GrammarEmitError>Expand description
Emits pest PEG grammar text from the grammar IR.
pest maps closely to the grammar IR: ordered choice uses |, sequences use
~, predicates use &/!, and repetition forms are native. RuleKind::Token
is emitted as pest’s compound-atomic $ rule modifier, the closest pest
analogue to a token-level rule and the syntax a future round-trip importer
should invert. Rust peg::parser! and winnow combinator emission follow the
same PEG algebra but are intentionally left to the Rust codegen path.
§Errors
Returns GrammarEmitError when the IR contains an internal invariant that
cannot form valid pest text, such as an empty choice, an empty character
class, a descending character range, or counted repetition with max < min.