Reproduce “On the Relation between Context-Free Grammars and Parsing Expression Grammars” on OpenResearch
Run Claude Code, Codex or any coding agent as a research agent: literature, hypotheses and experiments on your laptop, cluster or cloud GPUs.
Universal app for Apple silicon and Intel. Requires macOS 11 or later.
About this paper
Fabio Mascarenhas, Sérgio Medeiros, Roberto Ierusalimschy
The paper formally clarifies the relationship between Context-Free Grammars (CFGs) and Parsing Expression Grammars (PEGs) by introducing a new CFG formalism. It proves language-preserving transformations from specific CFG subsets, including LL(1), Strong-LL(k), and LL-regular grammars, into equivalent PEGs while preserving their structural integrity.
Key insights
- PEGs can be formally viewed as a deterministic, recognition-based extension of CFGs, with ambiguity systematically resolved through ordered choice and explicit failure.
- The structural integrity of various unambiguous CFG subsets can be preserved during translation to PEGs primarily by adding syntactic predicates for lookahead logic.
- Existing top-down CFG grammars can be theoretically and practically translated into equivalent PEGs, enabling their reuse across different parsing toolchains and facilitating interoperability.
Summary by alphaXiv.
Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.