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.
Supplemental Material
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- John Cocke. 1969. Programming Languages and Their Compilers: Preliminary Notes. New York University, USA. isbn:B0007F4UOAGoogle Scholar
- F. L. Deremer. 1969. PRACTICAL TRANSLATORS FOR LR(K) LANGUAGES. USA.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Xiaodong Jia, Ashish Kuma, and Gang Tan. 2021. A Derivative-based Parser Generator for Visibly Pushdown Grammars. arxiv:2109.04258.Google Scholar
- 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 Scholar
Digital Library
- Tadao Kasami. 1965. An Efficient Recognition and Syntax-Analysis Algorithm for Context-Free Languages. Air Force Cambridge Research Laboratory.Google Scholar
- 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 Scholar
Cross Ref
- 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 Scholar
Cross Ref
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Cross Ref
- 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 Scholar
- 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 Scholar
Cross Ref
Index Terms
A derivative-based parser generator for visibly Pushdown grammars
Recommendations
A Derivative-based Parser Generator for Visibly Pushdown Grammars
In this article, 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 ...
Nez: practical open grammar language
Onward! 2016: Proceedings of the 2016 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming and SoftwareNez is a PEG(Parsing Expressing Grammar)-based open grammar language that allows us to describe complex syntax constructs without action code. Since open grammars are declarative and free from a host programming language of parsers, software ...
On the use of extended grammars
ACM-SE 20: Proceedings of the 20th annual Southeast regional conferenceExtended context free grammars (ECFG) are context free grammars (CFG) in which the right side or each production may be an arbitrary finite state machine. There are ECFG subsets, ELR(k) and ELALR(k) which correspond to the context free subsets, LR(k) ...






Comments