×

A verified LL(1) parser generator. (English) Zbl 07649973

Harrison, John (ed.) et al., 10th international conference on interactive theorem proving, ITP 2019, September 9–12, 2019, Portland, OR, USA. Proceedings. Wadern: Schloss Dagstuhl – Leibniz-Zentrum für Informatik. LIPIcs – Leibniz Int. Proc. Inform. 141, Article 24, 18 p. (2019).
Summary: An LL(1) parser is a recursive descent algorithm that uses a single token of lookahead to build a grammatical derivation for an input sequence. We present an LL(1) parser generator that, when applied to grammar \(\mathcal{G}\), produces an LL(1) parser for \(\mathcal{G}\) if such a parser exists. We use the Coq Proof Assistant to verify that the generator and the parsers that it produces are sound and complete, and that they terminate on all inputs without using fuel parameters. As a case study, we extract the tool’s source code and use it to generate a JSON parser. The generated parser runs in linear time; it is two to four times slower than an unverified parser for the same grammar.
For the entire collection see [Zbl 1423.68027].

MSC:

68V15 Theorem proving (automated and interactive theorem provers, deduction, resolution, etc.)

Software:

TRX; Coq; ML
Full Text: DOI

References:

[1] Andrew W. Appel. Modern Compiler Implementation in ML. Cambridge University Press, 1998. · Zbl 0888.68035
[2] Aditi Barthwal and Michael Norrish. Verified, executable parsing. In European Symposium on Programming, pages 160-174. Springer, 2009. · Zbl 1234.68359
[3] Sandrine Blazy and Xavier Leroy. Mechanized semantics for the Clight subset of the C language. Journal of Automated Reasoning, 43(3):263-288, 2009. · Zbl 1185.68136
[4] 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. ACM. doi:10.1145/964001. 964011. · Zbl 1325.68120 · doi:10.1145/964001.964011
[5] Dan Goodin. Failure to patch two-month-old bug led to massive Equifax breach. https://arstechnica.com/information-technology/2017/09/ massive-equifax-breach-caused-by-failure-to-patch-two-month-old-bug/, 2017. 6 cloudflare: Cloudflare Reverse Proxies are Dumping Uninitialized Memory. https://bugs. chromium.org/p/project-zero/issues/detail?id=1139, 2017.
[6] Dick Grune and Ceriel JH Jacobs. Parsing Techniques (Monographs in Computer Science). Springer-Verlag, 2006. · Zbl 1137.68350
[7] Jacques-Henri Jourdan, François Pottier, and Xavier Leroy. Validating LR(1) parsers. In European Symposium on Programming, pages 397-416. Springer, 2012. · Zbl 1352.68131
[8] Adam Koprowski and Henri Binsztok. TRX: A formally verified parser interpreter. In European Symposium on Programming, pages 345-365. Springer, 2010. · Zbl 1260.68194
[9] Pierre Letouzey. Extraction in Coq: An overview. In Conference on Computability in Europe, pages 359-369. Springer, 2008. · Zbl 1142.68498
[10] Robin Milner. A theory of type polymorphism in programming. Journal of computer and system sciences, 17(3):348-375, 1978. · Zbl 0388.68003
[11] Yaron Minsky, Anil Madhavapeddy, and Jason Hickey. Real World OCaml: Functional programming for the masses. O’Reilly Media, Inc., 2013.
[12] Terence Parr and Kathleen Fisher. LL(*): The foundation of the ANTLR parser generator. In Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 425-436, June 2011.
[13] Terence Parr, Sam Harwell, and Kathleen Fisher. Adaptive LL(*) Parsing: The Power of Dynamic Analysis. In Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & Applications, volume 49, pages 579-598, October 2014. doi:10.1145/2714064.2660202. · doi:10.1145/2714064.2660202
[14] François Pottier and Yann Régis-Gianas. Menhir reference manual. Inria, August 2016.
[15] Matthieu Sozeau. PROGRAM-ing finger trees in Coq. In ACM SIGPLAN International Conference on Functional Programming. Association for Computing Machinery, 2007. · Zbl 1291.68157
[16] The Coq Proof Assistant, version 8.9.0, January 2019. doi:10.5281/zenodo.2554024. · doi:10.5281/zenodo.2554024
[17] Ryan Wisnesky, Gregory Michael Malecha, and John Gregory Morrisett. Certified web services in Ynot, 2010.
This reference list is based on information provided by the publisher or from digital mathematics libraries. Its items are heuristically matched to zbMATH identifiers and may contain data conversion errors. In some cases that data have been complemented/enhanced by data from zbMATH Open. This attempts to reflect the references listed in the original paper as accurately as possible without claiming completeness or a perfect matching.