Abstract
PEGs were formalized by Ford in 2004, and have several pragmatic operators (such as ordered choice and unlimited lookahead) for better expressing modern programming language syntax. Since these operators are not explicitly defined in the classic formal language theory, it is significant and still challenging to argue PEGs’ expressiveness in the context of formal language theory. Since PEGs are relatively new, there are several unsolved problems. One of the problems is revealing a subclass of PEGs that is equivalent to DFAs. This allows application of some techniques from the theory of regular grammar to PEGs. In this paper, we define Linear PEGs (LPEGs), a subclass of PEGs that is equivalent to DFAs. Surprisingly, LPEGs are formalized by only excluding some patterns of recursive nonterminal in PEGs, and include the full set of ordered choice, unlimited lookahead, and greedy repetition, which are characteristic of PEGs. Although the conversion judgement of parsing expressions into DFAs is undecidable in general, the formalism of LPEGs allows for a syntactical judgement of parsing expressions.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Aho, A.V., Ullman, J.D.: The Theory of Parsing, Translation, and Compiling. Prentice-Hall Inc., Upper Saddle River (1972)
Birman, A.: The TMG recognition schema. Ph.D. thesis aAI7101582, Princeton, NJ, USA (1970)
Birman, A., Ullman, J.D.: Parsing algorithms with backtrack. Inf. Control 23(1), 1–34 (1973). http://www.sciencedirect.com/science/article/pii/S0019995873908516
Brzozowski, J., Leiss, E.: On equations for regular languages, finite automata, and sequential networks. Theoret. Comput. Sci. 10(1), 19–35 (1980). http://www.sciencedirect.com/science/article/pii/0304397580900699
Chandra, A.K., Kozen, D.C., Stockmeyer, L.J.: Alternation. J. ACM 28(1), 114–133 (1981). http://doi.acm.org/10.1145/322234.322243
Fellah, A., Jürgensen, H., Yu, S.: Constructions for alternating finite automata. Int. J. Comput. Math. 35(1–4), 117–132 (1990). http://dx.doi.org/10.1080/00207169008803893
Ford, B.: Parsing expression grammars: a recognition-based syntactic foundation. In: Proceedings of 31st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 111–122. ACM, New York (2004). http://doi.acm.org/10.1145/964001.964011
Google: Re2. https://github.com/google/re2
Hopcroft, J.E., Motwani, R., Ullman, J.D.: Introduction to Automata Theory, Languages, and Computation, 3rd edn. Addison-Wesley Longman Publishing Co., Inc., Boston (2006)
Kuramitsu, K.: Nez: practical open grammar language. In: Proceedings of 2016 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software, Onward! 2016, pp. 29–42. ACM, New York (2016). http://doi.acm.org/10.1145/2986012.2986019
Linz, P.: An Introduction to Formal Language and Automata. Jones and Bartlett Publishers Inc., USA (2006)
Medeiros, S., Mascarenhas, F., Ierusalimschy, R.: From regexes to parsing expression grammars. Sci. Comput. Program. Part A 93, 3–18 (2014). http://www.sciencedirect.com/science/article/pii/S0167642312002171
Morihata, A.: Translation of regular expression with lookahead into finite state automaton. Comput. Softw. 29(1), 1_147–1_158 (2012)
Oikawa, M., Ierusalimschy, R., Moura, A.L.D.: Converting regexes to parsing expression grammars
Parr, T., Fisher, K.: Ll(*): the foundation of the ANTLR parser generator. In: Proceedings of 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2011, pp. 425–436. ACM, New York (2011). http://doi.acm.org/10.1145/1993498.1993548
Parr, T., Harwell, S., Fisher, K.: Adaptive ll(*) parsing: the power of dynamic analysis. SIGPLAN Not. 49(10), 579–598 (2014). http://doi.acm.org/10.1145/2714064.2660202
Thompson, K.: Programming techniques: regular expression search algorithm. Commun. ACM 11(6), 419–422 (1968). http://doi.acm.org/10.1145/363347.363387
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2017 Springer International Publishing AG
About this paper
Cite this paper
Chida, N., Kuramitsu, K. (2017). Linear Parsing Expression Grammars. In: Drewes, F., Martín-Vide, C., Truthe, B. (eds) Language and Automata Theory and Applications. LATA 2017. Lecture Notes in Computer Science(), vol 10168. Springer, Cham. https://doi.org/10.1007/978-3-319-53733-7_20
Download citation
DOI: https://doi.org/10.1007/978-3-319-53733-7_20
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-53732-0
Online ISBN: 978-3-319-53733-7
eBook Packages: Computer ScienceComputer Science (R0)