Skip to main content

A Formalization of the ABNF Notation and a Verified Parser of ABNF Grammars

  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 11294))

Abstract

Augmented Backus-Naur Form (ABNF) is a standardized formal grammar notation used in several Internet syntax specifications. This paper describes (i) a formalization of the syntax and semantics of the ABNF notation and (ii) a verified parser that turns ABNF grammar text into a formal representation usable in declarative specifications of correct parsing of ABNF-specified languages. This work has been developed in the ACL2 theorem prover.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Notes

  1. 1.

    The meta circularity of the definition of the concrete syntax of ABNF in ABNF is broken by the human in the loop, who defines an abstract syntax of ABNF in ACL2.

  2. 2.

    Future work includes exploring mechanisms to “plug” such external predicates into the ABNF semantics.

  3. 3.

    Future work includes exploring the formulation of an unambiguous ABNF grammar of ABNF that provably defines the same language as the current ambiguous one.

  4. 4.

    Even though the roles of SP and HTAB are “symmetric” in the rule WSP in Fig. 2, the function parse-wsp in Fig. 9 “asymmetrically” tries to parse SP before HTAB.

References

  1. Aho, A.V., Lam, M.S., Sethi, R., Ullman, J.D.: Compilers: Principles, Techniques, and Tools, 2nd edn. Pearson, London (2007)

    MATH  Google Scholar 

  2. Avigad, J., Zach, R.: The epsilon calculus. In: Zalta, E.N. (ed.) The Stanford Encyclopedia of Philosophy, summer 2016 edn. Metaphysics Research Lab, Stanford University (2016). https://plato.stanford.edu/archives/sum2016/entries/epsilon-calculus/

  3. Backus, J.W., et al.: Report on the algorithmic language ALGOL 60. Commun. ACM 3(5), 299–314 (1960)

    Article  MathSciNet  Google Scholar 

  4. Barthwal, A.: A formalisation of the theory of context-free languages in higher-order logic. Ph.D. thesis. The Australian National University (2010)

    Google Scholar 

  5. Barthwal, A., Norrish, M.: Verified, executable parsing. In: Castagna, G. (ed.) ESOP 2009. LNCS, vol. 5502, pp. 160–174. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-00590-9_12

    Chapter  Google Scholar 

  6. Berners-Lee, T., Fielding, R., Masinter, L.: Uniform Resource Identifier (URI): Generic syntax. Request for Comments (RFC) 3986, January 2005

    Google Scholar 

  7. Boyer, R.S., Moore, J.S.: A Computational Logic. Academic Press, Cambridge (1979)

    MATH  Google Scholar 

  8. Bray, T.: The JavaScript Object Notation (JSON) data interchange format. Request for Comments (RFC) 7159, March 2014

    Google Scholar 

  9. Crocker, D., Overell, P.: Augmented BNF for syntax specifications: ABNF. Request for Comments (RFC) 5234, January 2008

    Google Scholar 

  10. Doczkal, C., Kaiser, J.-O., Smolka, G.: A constructive theory of regular languages in Coq. In: Gonthier, G., Norrish, M. (eds.) CPP 2013. LNCS, vol. 8307, pp. 82–97. Springer, Cham (2013). https://doi.org/10.1007/978-3-319-03545-1_6

    Chapter  Google Scholar 

  11. Fielding, R., Reschke, J.: Hypertext Transfer Protocol (HTTP/1.1): Message syntax and routing. Request for Comments (RFC) 7230, June 2014

    Google Scholar 

  12. Gross, J.S.: An extensible framework for synthesizing efficient, verified parsers. Master’s thesis. Massachusetts Institute of Technology (2015)

    Google Scholar 

  13. Jourdan, J.-H., Pottier, F., Leroy, X.: Validating LR(1) parsers. In: Seidl, H. (ed.) ESOP 2012. LNCS, vol. 7211, pp. 397–416. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-28869-2_20

    Chapter  Google Scholar 

  14. Kaufmann, M., Moore, J.S.: The ACL2 theorem prover: Web page. http://www.cs.utexas.edu/users/moore/acl2

  15. Kaufmann, M., Moore, J.S.: A precise description of the ACL2 logic. Technical report. Department of Computer Sciences, University of Texas at Austin (1998)

    Google Scholar 

  16. Koprowski, A., Binsztok, H.: TRX: a formally verified parser interpreter. Log. Methods Comput. Sci. 7(2), 1–26 (2011)

    Article  MathSciNet  Google Scholar 

  17. Kumar, R., Myreen, M.O., Norrish, M., Owens, S.: CakeML: a verified implementation of ML. In: Proceedings of 41st ACM SIGPLAN Symposium on Principles of Programming Languages, POPL, pp. 179–191 (2014)

    Google Scholar 

  18. Kyzivat, P.: Case-sensitive string support in ABNF. Request for Comments (RFC) 7405, December 2014

    Google Scholar 

  19. Linhart, C., Klein, A., Heled, R., Orrin, S.: HTTP request smuggling. White paper, Watchfire (2005)

    Google Scholar 

  20. Nipkow, T.: Verified lexical analysis. In: Proceedings of 11th International Conference on Theorem Proving in Higher-Order Logics, TPHOL, pp. 1–15 (1998)

    Google Scholar 

  21. Parr, T., Fisher, K.: LL(*): the foundation of the ANTLR parser generator. In: Proceedings of 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI, pp. 425–436 (2011)

    Google Scholar 

  22. Ridge, T.: Simple, efficient, sound and complete combinator parsing for all context-free grammars, using an Oracle. In: Combemale, B., Pearce, D.J., Barais, O., Vinju, J.J. (eds.) SLE 2014. LNCS, vol. 8706, pp. 261–281. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-11245-9_15

    Chapter  Google Scholar 

  23. Swords, S., Davis, J.: Fix your types. In: Proceedings of 13th International Workshop on the ACL2 Theorem Prover and Its Applications (2015)

    Google Scholar 

  24. The ACL2 Community: The ACL2 theorem prover and community books: Source code. http://github.com/acl2/acl2

  25. The ACL2 Community: The ACL2 theorem prover and community books: User manual. http://www.cs.utexas.edu/~moore/acl2/manuals/current/manual

  26. Thomas, L.D.: APG: ABNF Parser Generator. http://www.coasttocoastresearch.com

  27. Wisnesky, R., Malecha, G., Morrisett, G.: Certified web services in Ynot. In: Proceedings of 5th International Workshop on Automated Specification and Verification of Web Systems, WWV, pp. 5–19 (2009)

    Google Scholar 

Download references

Acknowledgements

This work was supported by DARPA under Contract No. FA8750-15-C-0007.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Alessandro Coglio .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Coglio, A. (2018). A Formalization of the ABNF Notation and a Verified Parser of ABNF Grammars. In: Piskac, R., Rümmer, P. (eds) Verified Software. Theories, Tools, and Experiments. VSTTE 2018. Lecture Notes in Computer Science(), vol 11294. Springer, Cham. https://doi.org/10.1007/978-3-030-03592-1_10

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-03592-1_10

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-03591-4

  • Online ISBN: 978-3-030-03592-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics