TL;DR
This paper introduces a conservative extension to Parsing Expression Grammars (PEGs) that enables the correct handling of left recursion, a feature traditionally unsupported, thereby broadening PEGs' expressive power.
Contribution
It proposes a novel semantic extension for PEGs to support left recursion, including proofs of correctness and applicability to existing PEG implementations.
Findings
Extension supports direct and indirect left recursion in PEGs
Proves the extension is conservative and correct
Enables PEGs to express left-recursive CFG idioms
Abstract
Parsing Expression Grammars (PEGs) are a formalism that can describe all deterministic context-free languages through a set of rules that specify a top-down parser for some language. PEGs are easy to use, and there are efficient implementations of PEG libraries in several programming languages. A frequently missed feature of PEGs is left recursion, which is commonly used in Context-Free Grammars (CFGs) to encode left-associative operations. We present a simple conservative extension to the semantics of PEGs that gives useful meaning to direct and indirect left-recursive rules, and show that our extensions make it easy to express left-recursive idioms from CFGs in PEGs, with similar results. We prove the conservativeness of these extensions, and also prove that they work with any left-recursive PEG. PEGs can also be compiled to programs in a low-level parsing machine. We present an…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
