scispace - formally typeset
Proceedings ArticleDOI

Parsing expression grammars: a recognition-based syntactic foundation

Bryan Ford
- Vol. 39, Iss: 1, pp 111-122
Reads0
Chats0
TLDR
PEGs address frequently felt expressiveness limitations of CFGs and REs, simplifying syntax definitions and making it unnecessary to separate their lexical and hierarchical components, and are here proven equivalent in effective recognition power.
Abstract
For decades we have been using Chomsky's generative system of grammars, particularly context-free grammars (CFGs) and regular expressions (REs), to express the syntax of programming languages and protocols The power of generative grammars to express ambiguity is crucial to their original purpose of modelling natural languages, but this very power makes it unnecessarily difficult both to express and to parse machine-oriented languages using CFGs Parsing Expression Grammars (PEGs) provide an alternative, recognition-based formal foundation for describing machine-oriented syntax, which solves the ambiguity problem by not introducing ambiguity in the first place Where CFGs express nondeterministic choice between alternatives, PEGs instead use prioritized choice PEGs address frequently felt expressiveness limitations of CFGs and REs, simplifying syntax definitions and making it unnecessary to separate their lexical and hierarchical components A linear-time parser can be built for any PEG, avoiding both the complexity and fickleness of LR parsers and the inefficiency of generalized CFG parsing While PEGs provide a rich set of operators for constructing grammars, they are reducible to two minimal recognition schemas developed around 1970, TS/TDPL and gTS/GTDPL, which are here proven equivalent in effective recognition power

read more

Content maybe subject to copyright    Report

Citations
More filters
Proceedings Article

Pi - A Pattern Language

TL;DR: π provides an abstraction mechanism based on parameterized symbols which is capable of semantically and syntactically unifying programming concepts like variables, control-structures, procedures and functions into one concept: the pattern.
Journal ArticleDOI

LL(*): the foundation of the ANTLR parser generator

TL;DR: By statically removing as much speculation as possible, LL(*) provides the expressivity of PEGs while retaining LL's good error handling and unrestricted grammar actions.
Journal ArticleDOI

Silver: An extensible attribute grammar system

TL;DR: Silver is described, an extensible attribute grammar specification system, and it is shown how it can be extended with general purpose features such as pattern matching and domain-specific featuressuch as collection attributes and constructs for supporting data-flow analysis of imperative programs.
Journal ArticleDOI

Better extensibility through modular syntax

TL;DR: Rats!, a parser generator for Java that supports easily extensible syntax, enables other grammar writers to realize real-world language extensions in little time and code, and generates parsers that consistently out-perform parsers created by two GLR parser generators.
References
More filters
Book

The C++ Programming Language

TL;DR: Bjarne Stroustrup makes C even more accessible to those new to the language, while adding advanced information and techniques that even expert C programmers will find invaluable.
Book

The Theory of Parsing, Translation, and Compiling

TL;DR: It is the hope that the algorithms and concepts presented in this book will survive the next generation of computers and programming languages, and that at least some of them will be applicable to fields other than compiler writing.
Book ChapterDOI

Tree-adjoining grammars

TL;DR: A tree generating system called tree-adjoining grammar (TAG) is described and a number of formal results have been established for TAGs, which are of interest to researchers in formal languages and automata, including those interested in tree grammars and tree automata.
Journal ArticleDOI

ANTLR: a predicated- LL(k) parser generator

TL;DR: ANTLR is introduced, a public‐domain parser generator that combines the flexibility of hand‐coded parsing with the convenience of a parser generator, which is a component of PCCTS.
Book

The C++ Programming Language, 4th Edition

TL;DR: The C++ Programming Language as discussed by the authors provides comprehensive coverage of C++ language features and standard library components and makes C++ even more accessible to those new to the language while adding information and techniques that even expert programmers will find invaluable.