Computational Model for Parsing Expression Grammars

Authors Alexander Rubtsov , Nikita Chudinov



PDF
Thumbnail PDF

File

LIPIcs.MFCS.2024.80.pdf
  • Filesize: 0.71 MB
  • 13 pages

Document Identifiers

Author Details

Alexander Rubtsov
  • HSE University, Moscow, Russia
  • MIPT, Moscow, Russia
Nikita Chudinov
  • Google, Zürich, Switzerland

Acknowledgements

Authors thank Mikhail Iumanov for helpful discussions and anonymous referees for the helpful comments.

Cite As Get BibTex

Alexander Rubtsov and Nikita Chudinov. Computational Model for Parsing Expression Grammars. In 49th International Symposium on Mathematical Foundations of Computer Science (MFCS 2024). Leibniz International Proceedings in Informatics (LIPIcs), Volume 306, pp. 80:1-80:13, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2024) https://doi.org/10.4230/LIPIcs.MFCS.2024.80

Abstract

We present a computational model for Parsing Expression Grammars (PEGs). The predecessor of PEGs top-down parsing languages (TDPLs) were discovered by A. Birman and J. Ullman in the 1960-s, B. Ford showed in 2004 that both formalisms recognize the same class named Parsing Expression Languages (PELs). A. Birman and J. Ullman established such important properties like TDPLs generate any DCFL and some non-context-free languages like a^n b^n c^n, a linear-time parsing algorithm was constructed as well. But since this parsing algorithm was impractical in the 60-s TDPLs were abandoned and then upgraded by B. Ford to PEGs, so the parsing algorithm was improved (from the practical point of view) as well. Now PEGs are actively used in compilers (eg., Python replaced LL(1)-parser with a PEG one) so as for text processing as well. In this paper, we present a computational model for PEG, obtain structural properties of PELs, namely proof that PELs contain Boolean closure of regular closure of DCFLs and PELs are closed over left concatenation with regular closure of DCFLs. We present an extension of the PELs class based on the extension of our computational model. Our model is an upgrade of deterministic pushdown automata (DPDA) such that during the pop of a symbol it is allowed to return the head to the position of the push of the symbol. We provide a linear-time simulation algorithm for the 2-way version of this model, which is similar to the famous S. Cook linear-time simulation algorithm of 2-way DPDA.

Subject Classification

ACM Subject Classification
  • Theory of computation → Formal languages and automata theory
Keywords
  • PEG
  • formal languages
  • pushdown automata
  • two-way pushdown automata

Metrics

  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    0
    PDF Downloads

References

  1. Amir Abboud, Arturs Backurs, and Virginia Vassilevska Williams. If the Current Clique Algorithms Are Optimal, So is Valiant’s Parser. In IEEE 56th Annual Symposium on Foundations of Computer Science, FOCS 2015, Berkeley, CA, USA, 17-20 October, 2015, FOCS '15, pages 98-117, USA, 2015. IEEE Computer Society. URL: https://doi.org/10.1109/FOCS.2015.16.
  2. A.V. Aho, J.E. Hopcroft, and J.D. Ullman. The Design and Analysis of Computer Algorithms. Addison-Wesley series in computer science and information processing. Addison-Wesley Publishing Company, 1974. Google Scholar
  3. Eberhard Bertsch and Mark-Jan Nederhof. Regular Closure of Deterministic Languages. SIAM J. Comput., 29:81-102, 1999. Google Scholar
  4. A. Birman and J. D. Ullman. Parsing algorithms with backtrack. In 11th Annual Symposium on Switching and Automata Theory (SWAT 1970), pages 153-174, 1970. Google Scholar
  5. Stephen A Cook. Linear time simulation of deterministic two-way pushdown automata. Department of Computer Science, University of Toronto, 1970. Google Scholar
  6. Bryan Ford. Packrat Parsing: Simple, Powerful, Lazy, Linear Time, Functional Pearl. In Proceedings of the Seventh ACM SIGPLAN International Conference on Functional Programming, ICFP '02, pages 36-47, New York, NY, USA, 2002. Association for Computing Machinery. URL: https://doi.org/10.1145/581478.581483.
  7. Bryan Ford. Parsing Expression Grammars: A Recognition-Based Syntactic Foundation. In Proceedings of the 31st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL '04, pages 111-122, New York, NY, USA, 2004. Association for Computing Machinery. URL: https://doi.org/10.1145/964001.964011.
  8. Robert Glück. Simulation of Two-Way Pushdown Automata Revisited. In Electronic Proceedings in Theoretical Computer Science, volume 129, pages 250-258. Open Publishing Association, September 2013. Google Scholar
  9. John E. Hopcroft and Jeffrey D. Ullman. Introduction to automata theory, languages and computation. Addison-Wesley, 1979. Google Scholar
  10. Donald E. Knuth, James H. Morris, Jr., and Vaughan R. Pratt. Fast Pattern Matching in Strings. SIAM Journal on Computing, 6(2):323-350, 1977. URL: https://doi.org/10.1137/0206024.
  11. Lillian Lee. Fast context-free grammar parsing requires fast boolean matrix multiplication. J. ACM, 49(1):1-15, 2002. Google Scholar
  12. Bruno Loff, Nelma Moreira, and Rogério Reis. The computational power of parsing expression grammars. In Mizuho Hoshi and Shinnosuke Seki, editors, Developments in Language Theory - 22nd International Conference, DLT 2018, Tokyo, Japan, September 10-14, 2018, Proceedings, volume 11088 of Lecture Notes in Computer Science, pages 491-502. Springer, 2018. URL: https://doi.org/10.1007/978-3-319-98654-8_40.
  13. Alexander Rubtsov and Nikita Chudinov. Computational Model for Parsing Expression Grammars, 2024. URL: https://arxiv.org/abs/2406.14911.
  14. Alexander A. Rubtsov. A Linear-Time Simulation of Deterministic d-Limited Automata. In Developments in Language Theory: 25th International Conference, DLT 2021, Porto, Portugal, August 16–20, 2021, Proceedings, pages 342-354, Berlin, Heidelberg, 2021. Springer-Verlag. URL: https://doi.org/10.1007/978-3-030-81508-0_28.
  15. Michael Sipser. Introduction to the Theory of Computation. Course Technology, Boston, MA, third edition, 2013. Google Scholar
  16. Guido van Rossum, Pablo Galindo, and Lysandros Nikolaou. New PEG parser for CPython, 2020. URL: https://peps.python.org/pep-0617/.
Questions / Remarks / Feedback
X

Feedback for Dagstuhl Publishing


Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail