Abstract
We propose a new unambiguous grammar formalism, referred to as ordered context-free grammars, which is identical to context-free grammars, apart from the property that it also places an order on parse trees. Since only a minor modification to ordered context-free grammars is required to obtain parsing expression grammars, the relationship between context-free grammars and parsing expression grammars becomes more evident. By preserving how ordered context-free grammars support left-recursion, parsing expression grammars is modified to support left recursion in ways much more natural than current approaches.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
Berglund, M., van der Merwe, B.: On the semantics of regular expression parsing in the wild. Theor. Comput. Sci. 679, 69–82 (2017)
Ford, B.: Parsing expression grammars: a recognition-based syntactic foundation. In: Proceedings of the 31st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 111–122 (2004)
Loff, B., Moreira, N., Reis, R.: The computational power of parsing expression grammars. J. Comput. Syst. Sci. 111, 1–21 (2020)
Parr, T., Fisher, K.: LL(*): the foundation of the ANTLR parser generator. In: Hall, M.W., Padua, D.A. (eds.) Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 425–436 (2011)
Nivat, M., Podelski, A. (eds.): Tree Automata and Languages. North-Holland, Amsterdam (1992)
Warth, A., Douglass, J.R., Millstein, T.D.: Packrat parsers can support left recursion. In: Glück, R., de Moor, O. (eds.) Proceedings of the 2008 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-based Program Manipulation, pp. 103–110 (2008)
Pegen. https://github.com/we-like-parsers/pegen. Accessed 28 Feb 2022
Medeiros, S., Mascarenhas, F., Ierusalimschy, R.: Left recursion in parsing expression grammars. Sci. Comput. Program. 96, 177–190 (2014)
Okhotin, A.: Boolean grammars. Inf. Comput. 194(1), 19–48 (2004)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2022 Springer Nature Switzerland AG
About this paper
Cite this paper
van der Merwe, B., Berglund, M. (2022). Ordered Context-Free Grammars. In: Caron, P., Mignot, L. (eds) Implementation and Application of Automata. CIAA 2022. Lecture Notes in Computer Science, vol 13266. Springer, Cham. https://doi.org/10.1007/978-3-031-07469-1_4
Download citation
DOI: https://doi.org/10.1007/978-3-031-07469-1_4
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-07468-4
Online ISBN: 978-3-031-07469-1
eBook Packages: Computer ScienceComputer Science (R0)