Back to Search
Start Over
On the relation between context-free grammars and parsing expression grammars.
- Source :
-
Science of Computer Programming . Sep2014, Vol. 89 Issue Part C, p235-250. 16p. - Publication Year :
- 2014
-
Abstract
- Abstract: Context-Free Grammars (CFGs) and Parsing Expression Grammars (PEGs) have several similarities and a few differences in both their syntax and semantics, but they are usually presented through formalisms that hinder a proper comparison. In this paper we present a new formalism for CFGs that highlights the similarities and differences between them. The new formalism borrows from PEGs the use of parsing expressions and the recognition-based semantics. We show how one way of removing non-determinism from this formalism yields a formalism with the semantics of PEGs. We also prove, based on these new formalisms, how grammars define the same language whether interpreted as CFGs or as PEGs, and also show how strong- , right-linear, and LL-regular grammars have simple language-preserving translations from CFGs to PEGs. Once these classes of CFGs can be automatically translated to equivalent PEGs, we can reuse classic top-down grammars in PEG-based tools. [Copyright &y& Elsevier]
Details
- Language :
- English
- ISSN :
- 01676423
- Volume :
- 89
- Issue :
- Part C
- Database :
- Academic Search Index
- Journal :
- Science of Computer Programming
- Publication Type :
- Academic Journal
- Accession number :
- 95933230
- Full Text :
- https://doi.org/10.1016/j.scico.2014.01.012