1,861 research outputs found
Left Recursion in Parsing Expression Grammars
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 extension to the semantics of the operations of this parsing machine
that let it interpret left-recursive PEGs, and prove that this extension is
correct with regards to our semantics for left-recursive PEGs.Comment: Extended version of the paper "Left Recursion in Parsing Expression
Grammars", that was published on 2012 Brazilian Symposium on Programming
Language
Recommended from our members
Data Structures and Algorithms for Disjoint Set Union Problems
This paper surveys algorithmic techniques and data structures that have been proposed to solve the set union problem and its variants. Their discovery required a new set of algorithmic tools that have proven useful in other areas. Special attention is devoted to recent extensions of the original set union problem, and some effort is made to provide a unifying theoretical framework for this growing body of algorithms
Hipster: Integrating Theory Exploration in a Proof Assistant
This paper describes Hipster, a system integrating theory exploration with
the proof assistant Isabelle/HOL. Theory exploration is a technique for
automatically discovering new interesting lemmas in a given theory development.
Hipster can be used in two main modes. The first is exploratory mode, used for
automatically generating basic lemmas about a given set of datatypes and
functions in a new theory development. The second is proof mode, used in a
particular proof attempt, trying to discover the missing lemmas which would
allow the current goal to be proved. Hipster's proof mode complements and
boosts existing proof automation techniques that rely on automatically
selecting existing lemmas, by inventing new lemmas that need induction to be
proved. We show example uses of both modes
- …