Overview
Parsing Expression Grammar parsing treats alternatives as ordered choices, often making grammar behavior deterministic and suitable for recursive descent or packrat parsing.
Parses text using ordered-choice grammar rules that describe one intended parse.
Compact metadata for implementation and discovery.
Parsing Expression Grammar parsing treats alternatives as ordered choices, often making grammar behavior deterministic and suitable for recursive descent or packrat parsing.
Quick facts
Runtime and memory behavior at a glance.
Best
O(n)
Average
O(n) with memoization
Worst
Exponential without memoization in some grammars
Space
O(n * rules) with memoization
Show ordered alternatives being tried left to right until one succeeds.
Ordered choice means grammar alternative order changes the language accepted.
What each reference supports for this entry.
Parsing reference for PEG recognition behavior, prioritized choice, and practical parser control flow.
Original reference for PEG recognition semantics, prioritized choice, and parser behavior for parsing expression grammars.
Open sourceGood next jumps from the relationship graph, ranked for useful discovery.
PEG parsers are often implemented with packrat memoization for linear-time recognition.