skip to main content
research-article
Open Access

A derivative-based parser generator for visibly Pushdown grammars

Published:15 October 2021Publication History
Skip Abstract Section

Abstract

In this paper, we present a derivative-based, functional recognizer and parser generator for visibly pushdown grammars. The generated parser accepts ambiguous grammars and produces a parse forest containing all valid parse trees for an input string in linear time. Each parse tree in the forest can then be extracted also in linear time. Besides the parser generator, to allow more flexible forms of the visibly pushdown grammars, we also present a translator that converts a tagged CFG to a visibly pushdown grammar in a sound way, and the parse trees of the tagged CFG are further produced by running the semantic actions embedded in the parse trees of the translated visibly pushdown grammar. The performance of the parser is compared with a popular parsing tool ANTLR and other popular hand-crafted parsers. The correctness of the core parsing algorithm is formally verified in the proof assistant Coq.

Skip Supplemental Material Section

Supplemental Material

Auxiliary Presentation Video

This is a presentation video of my talk at OOPSLA 2021 on our paper accepted in the research track. In this paper, we present a derivative-based, functional recognizer and parser generator for visibly pushdown grammars. The parser generator is formally verified, and the generated parser is guaranteed to parse strings in linear-time.

References

  1. Rajeev Alur and P. Madhusudan. 2009. Adding Nesting Structure to Words. J. ACM, 56, 3 (2009), Article 16, May, 43 pages. issn:0004-5411 https://doi.org/10.1145/1516512.1516518 Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Janusz A. Brzozowski. 1964. Derivatives of Regular Expressions. J. ACM, 11, 4 (1964), Oct., 481–494. issn:0004-5411 https://doi.org/10.1145/321239.321249 Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. John Cocke. 1969. Programming Languages and Their Compilers: Preliminary Notes. New York University, USA. isbn:B0007F4UOAGoogle ScholarGoogle Scholar
  4. F. L. Deremer. 1969. PRACTICAL TRANSLATORS FOR LR(K) LANGUAGES. USA.Google ScholarGoogle Scholar
  5. Jay Earley. 1970. An Efficient Context-Free Parsing Algorithm. Commun. ACM, 13, 2 (1970), Feb., 94–102. issn:0001-0782 https://doi.org/10.1145/362007.362035 Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Romain Edelmann, Jad Hamza, and Viktor Kunčak. 2020. Zippy LL(1) Parsing with Derivatives. In Proceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2020). Association for Computing Machinery, New York, NY, USA. 1036–1051. isbn:9781450376136 https://doi.org/10.1145/3385412.3385992 Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Bryan Ford. 2004. Parsing Expression Grammars: A Recognition-Based Syntactic Foundation. SIGPLAN Not., 39, 1 (2004), Jan., 111–122. issn:0362-1340 https://doi.org/10.1145/982962.964011 Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Ian Henriksen, Gianfranco Bilardi, and Keshav Pingali. 2019. Derivative Grammars: A Symbolic Approach to Parsing with Derivatives. Proc. ACM Program. Lang., 3, OOPSLA (2019), Article 127, Oct., 28 pages. https://doi.org/10.1145/3360553 Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Xiaodong Jia, Ashish Kuma, and Gang Tan. 2021. A Derivative-based Parser Generator for Visibly Pushdown Grammars. arxiv:2109.04258.Google ScholarGoogle Scholar
  10. Jacques-Henri Jourdan, François Pottier, and Xavier Leroy. 2012. Validating LR (1) parsers. 397–416. isbn:978-3-642-28868-5 https://doi.org/10.1007/978-3-642-28869-2_20 Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Tadao Kasami. 1965. An Efficient Recognition and Syntax-Analysis Algorithm for Context-Free Languages. Air Force Cambridge Research Laboratory.Google ScholarGoogle Scholar
  12. Adam Koprowski and Henri Binsztok. 2011. TRX: A Formally Verified Parser Interpreter. Logical Methods in Computer Science, 7 (2011), 05, isbn:978-3-642-11956-9 https://doi.org/10.2168/LMCS-7(2:18)2011 Google ScholarGoogle ScholarCross RefCross Ref
  13. Sam Lasser, Chris Casinghino, Kathleen Fisher, and Cody Roux. 2019. A Verified LL(1) Parser Generator. In 10th International Conference on Interactive Theorem Proving (ITP 2019), John Harrison, John O’Leary, and Andrew Tolmach (Eds.) (Leibniz International Proceedings in Informatics (LIPIcs), Vol. 141). Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany. 24:1–24:18. isbn:978-3-95977-122-1 issn:1868-8969 https://doi.org/10.4230/LIPIcs.ITP.2019.24 Google ScholarGoogle ScholarCross RefCross Ref
  14. Sam Lasser, Chris Casinghino, Kathleen Fisher, and Cody Roux. 2021. CoStar: A Verified ALL(*) Parser. In Proceedings of the 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation (PLDI 2021). Association for Computing Machinery, New York, NY, USA. 420–434. isbn:9781450383912 https://doi.org/10.1145/3453483.3454053 Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Matthew Might, David Darais, and Daniel Spiewak. 2011. Parsing with Derivatives: A Functional Pearl. In Proceedings of the 16th ACM SIGPLAN International Conference on Functional Programming (ICFP ’11). Association for Computing Machinery, New York, NY, USA. 189–195. isbn:9781450308656 https://doi.org/10.1145/2034773.2034801 Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Greg Morrisett, Gang Tan, Joseph Tassarotti, Jean-Baptiste Tristan, and Edward Gan. 2012. RockSalt: Better, Faster, Stronger SFI for the X86. SIGPLAN Not., 47, 6 (2012), June, 395–404. issn:0362-1340 https://doi.org/10.1145/2345156.2254111 Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Scott Owens, John Reppy, and Aaron Turon. 2009. Regular-Expression Derivatives Re-Examined. J. Funct. Program., 19, 2 (2009), March, 173–190. issn:0956-7968 https://doi.org/10.1017/S0956796808007090 Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Terence Parr, Sam Harwell, and Kathleen Fisher. 2014. Adaptive LL(*) Parsing: The Power of Dynamic Analysis. SIGPLAN Not., 49, 10 (2014), Oct., 579–598. issn:0362-1340 https://doi.org/10.1145/2714064.2660202 Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Theofilos Petsios, Adrian Tang, Salvatore Stolfo, Angelos D. Keromytis, and Suman Jana. 2017. NEZHA: Efficient Domain-Independent Differential Testing. In 2017 IEEE Symposium on Security and Privacy (SP). 615–632. https://doi.org/10.1109/SP.2017.27 Google ScholarGoogle ScholarCross RefCross Ref
  20. Tahina Ramananandro, Antoine Delignat-Lavaud, Cedric Fournet, Nikhil Swamy, Tej Chajed, Nadim Kobeissi, and Jonathan Protzenko. 2019. EverParse: Verified Secure Zero-Copy Parsers for Authenticated Message Formats. In 28th USENIX Security Symposium (USENIX Security 19). USENIX Association, Santa Clara, CA. 1465–1482. isbn:978-1-939133-06-9 https://www.usenix.org/conference/usenixsecurity19/presentation/delignat-lavaudGoogle ScholarGoogle Scholar
  21. Daniel H. Younger. 1967. Recognition and parsing of context-free languages in time n3. Information and Control, 10, 2 (1967), 189–208. issn:0019-9958 https://doi.org/10.1016/S0019-9958(67)80007-X Google ScholarGoogle ScholarCross RefCross Ref

Index Terms

  1. A derivative-based parser generator for visibly Pushdown grammars

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!