Reference. LL(*): the foundation of the ANTLR parser generator
Cite
Cited by (4)
CoStar: A verified ALL(*) parser lasserCoStarVerifiedALL2021
Parsers are security-critical components of many software systems, and verified parsing therefore has a key role to play in secure software design. However, existing verified parsers for context-free grammars are limited in their expressiveness, termination properties, or performance characteristics. They are only compatible with a restricted class of grammars, they are not guaranteed to terminate on all inputs, or they are not designed to be performant on grammars for real-world programming languages and data formats. In this work, we present CoStar, a verified parser that addresses these limitations. The parser is implemented with the Coq Proof Assistant and is based on the ALL(*) parsing algorithm. CoStar is sound and complete for all non-left-recursive grammars; it produces a correct parse tree for its input whenever such a tree exists, and it correctly detects ambiguous inputs. CoStar also provides strong termination guarantees; it terminates without error on all inputs when applied to a non-left-recursive grammar. Finally, CoStar achieves linear-time performance on a range of unambiguous grammars for commonly used languages and data formats.
Zippy LL(1) parsing with derivatives EdelmannZippy2020
In this paper, we present an efficient, functional, and formally verified parsing algorithm for LL(1) context-free expressions based on the concept of derivatives of formal languages. Parsing with derivatives is an elegant parsing technique, which, in the general case, suffers from cubic worst-case time complexity and slow performance in practice. We specialise the parsing with derivatives algorithm to LL(1) context-free expressions, where alternatives can be chosen given a single token of lookahead. We formalise the notion of LL(1) expressions and show how to efficiently check the LL(1) property. Next, we present a novel linear-time parsing with derivatives algorithm for LL(1) expressions operating on a zipper-inspired data structure. We prove the algorithm correct in Coq and present an implementation as a part of Scallion, a parser combinators framework in Scala with enumeration and pretty printing capabilities.
A Verified LL(1) Parser Generator lasserLL1_2019
An LL(1) parser is a recursive descent algorithm that uses a single token of lookahead to build a grammatical derivation for an input sequence. We present an LL(1) parser generator that, when applied to grammar G, produces an LL(1) parser for G if such a parser exists. We use the Coq Proof Assistant to verify that the generator and the parsers that it produces are sound and complete, and that they terminate on all inputs without using fuel parameters. As a case study, we extract the tool’s source code and use it to generate a JSON parser. The generated parser runs in linear time; it is two to four times slower than an unverified parser for the same grammar.
Adaptive LL(*) parsing: the power of dynamic analysis parr-2014-adaptive
Cites 18 works (1 here)
With notes (1)
An efficient context-free parsing algorithm Earley1970
A parsing algorithm which seems to be the most efficient general context-free algorithm known is described. It is similar to both Knuth’s LR(k) algorithm and the familiar top-down algorithm. It has a time bound proportional to n3 (where n is the length of the string being parsed) in general; it has an n2 bound for unambiguous grammars; and it runs in linear time on a large class of grammars, which seems to include most practical context-free programming language grammars. In an empirical comparison it appears to be superior to the top-down and bottom-up algorithms studied by Griffiths and Petrick.
External (17)
- Semantics and algorithms for data-dependent grammars (2010)
- Better extensibility through modular syntax (2006)
- Parsing expression grammars: a recognition-based syntactic foundation (2004)
- Elkhound: A Fast, Practical GLR Parser Generator (2004)
- Packrat parsing: simple, powerful, lazy, linear time, functional pearl (2002)
- Practical Experiments with Regular Approximation of Context-Free Languages (2000)
- Adding semantic and syntactic predicates to LL(k): pred-LL(k) (1994)
- Obtaining practical variants of LL(k) and LR(k) for k > 1 by splitting the atomic k-tuple (PhD thesis, Purdue University) (1993)
- Practical arbitrary lookahead LR parsing (1990)
- Efficient Parsing for Natural Language (1986)
- Compact recursive‐descent parsing of expressions (1985)
- LL(k) parsing for attributed grammars (1979)
- On LL-regular grammars (1979)
- On the parsing of LL-regular grammars (1976)
- LL-regular grammars (1975)
- LR-regular grammars An extension of LR(k) grammars (1971)
- Transition network grammars for natural language analysis (1970)