Skip to main content

Advertisement

SpringerLink
Log in
Menu
Find a journal Publish with us
Search
Cart
Book cover

European Symposium on Programming

ESOP 2012: Programming Languages and Systems pp 397–416Cite as

  1. Home
  2. Programming Languages and Systems
  3. Conference paper
Validating LR(1) Parsers

Validating LR(1) Parsers

  • Jacques-Henri Jourdan17,18,
  • François Pottier18 &
  • Xavier Leroy18 
  • Conference paper
  • 1616 Accesses

  • 42 Citations

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

Abstract

An LR(1) parser is a finite-state automaton, equipped with a stack, which uses a combination of its current state and one lookahead symbol in order to determine which action to perform next. We present a validator which, when applied to a context-free grammar \(\mathcal G\) and an automaton \(\mathcal A\), checks that \(\mathcal A\) and \(\mathcal G\) agree. Validating the parser provides the correctness guarantees required by verified compilers and other high-assurance software that involves parsing. The validation process is independent of which technique was used to construct \(\mathcal A\). The validator is implemented and proved correct using the Coq proof assistant. As an application, we build a formally-verified parser for the C99 language.

Keywords

  • Parse Tree
  • Input Stream
  • Semantic Action
  • Terminal Symbol
  • Abstract Syntax Tree

These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Download conference paper PDF

References

  1. Leroy, X.: Formal verification of a realistic compiler. Communications of the ACM 52, 107–115 (2009)

    CrossRef  Google Scholar 

  2. Barthwal, A., Norrish, M.: Verified, Executable Parsing. In: Castagna, G. (ed.) ESOP 2009. LNCS, vol. 5502, pp. 160–174. Springer, Heidelberg (2009)

    CrossRef  Google Scholar 

  3. Barthwal, A.: A formalisation of the theory of context-free languages in higher order logic. PhD thesis, Australian National University (December 2010)

    Google Scholar 

  4. DeRemer, F.L.: Simple LR(k) grammars. Communications of the ACM 14(7), 453–460 (1971)

    CrossRef  MathSciNet  MATH  Google Scholar 

  5. Anderson, T., Eve, J., Horning, J.J.: Efficient LR(1) parsers. Acta Informatica 2, 12–39 (1973)

    CrossRef  MathSciNet  MATH  Google Scholar 

  6. Pager, D.: A practical general method for constructing LR(k) parsers. Acta Informatica 7, 249–268 (1977)

    CrossRef  MathSciNet  MATH  Google Scholar 

  7. Knuth, D.E.: On the translation of languages from left to right. Information & Control 8, 607–639 (1965)

    CrossRef  MathSciNet  Google Scholar 

  8. Pottier, F., Régis-Gianas, Y.: The Menhir parser generator, http://gallium.inria.fr/~fpottier/menhir/

  9. Jourdan, J.H., Pottier, F., Leroy, X.: Coq code for validating LR(1) parsers, http://www.eleves.ens.fr/home/jjourdan/parserValidator.tgz

  10. Filliâtre, J.-C., Letouzey, P.: Functors for Proofs and Programs. In: Schmidt, D. (ed.) ESOP 2004. LNCS, vol. 2986, pp. 370–384. Springer, Heidelberg (2004)

    CrossRef  Google Scholar 

  11. ISO/IEC: Programming languages — C (2007) International standard ISO/IEC 9899:TC3

    Google Scholar 

  12. Padioleau, Y.: Parsing C/C++ Code without Pre-processing. In: de Moor, O., Schwartzbach, M.I. (eds.) CC 2009. LNCS, vol. 5501, pp. 109–125. Springer, Heidelberg (2009)

    CrossRef  Google Scholar 

  13. Pottier, F., Régis-Gianas, Y.: Towards efficient, typed LR parsers. Electronic Notes in Theoretical Computer Science 148(2), 155–180 (2006)

    CrossRef  Google Scholar 

  14. Ford, B.: Packrat parsing: simple, powerful, lazy, linear time. In: ACM International Conference on Functional Programming (ICFP), pp. 36–47 (October 2002)

    Google Scholar 

  15. Ford, B.: Parsing expression grammars: a recognition-based syntactic foundation. In: ACM Symposium on Principles of Programming Languages (POPL), pp. 111–122 (January 2004)

    Google Scholar 

  16. Warth, A., Douglass, J.R., Millstein, T.D.: Packrat parsers can support left recursion. In: ACM Workshop on Evaluation and Semantics-Based Program Manipulation (PEPM), pp. 103–110 (January 2008)

    Google Scholar 

  17. Koprowski, A., Binsztok, H.: TRX: A formally verified parser interpreter. Logical Methods in Computer Science 7 (2011)

    Google Scholar 

  18. Wisnesky, R., Malecha, G., Morrisett, G.: Certified web services in Ynot. In: Workshop on Automated Specification and Verification of Web Systems (July 2009)

    Google Scholar 

  19. Samet, H.: Automatically Proving the Correctness of Translations Involving Optimized Code. PhD thesis, Stanford University (1975)

    Google Scholar 

  20. Pnueli, A., Siegel, M., Singerman, E.: Translation Validation. In: Steffen, B. (ed.) TACAS 1998. LNCS, vol. 1384, pp. 151–166. Springer, Heidelberg (1998)

    CrossRef  Google Scholar 

  21. Necula, G.C.: Translation validation for an optimizing compiler. In: ACM Conference on Programming Language Design and Implementation (PLDI), pp. 83–95. ACM Press (2000)

    Google Scholar 

  22. Tristan, J.B., Leroy, X.: A simple, verified validator for software pipelining. In: ACM Symposium on Principles of Programming Languages (POPL), pp. 83–92. ACM Press (2010)

    Google Scholar 

  23. Klein, G., Nipkow, T.: A machine-checked model for a Java-like language, virtual machine and compiler. ACM Transactions on Programming Languages and Systems 28, 619–695 (2006)

    CrossRef  Google Scholar 

  24. Aho, A.V., Ullman, J.D.: The theory of parsing, translation, and compiling. Prentice-Hall (1972)

    Google Scholar 

  25. Sozeau, M.: Program-ing finger trees in Coq. In: ACM International Conference on Functional Programming (ICFP), pp. 13–24 (September 2007)

    Google Scholar 

Download references

Author information

Authors and Affiliations

  1. École Normale Supérieure, France

    Jacques-Henri Jourdan

  2. INRIA Paris-Rocquencourt, France

    Jacques-Henri Jourdan, François Pottier & Xavier Leroy

Authors
  1. Jacques-Henri Jourdan
    View author publications

    You can also search for this author in PubMed Google Scholar

  2. François Pottier
    View author publications

    You can also search for this author in PubMed Google Scholar

  3. Xavier Leroy
    View author publications

    You can also search for this author in PubMed Google Scholar

Editor information

Editors and Affiliations

  1. Technische Universität München, Boltzmannstrasse 3, 85748, Garching, Germany

    Helmut Seidl

Rights and permissions

Reprints and Permissions

Copyright information

© 2012 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Jourdan, JH., Pottier, F., Leroy, X. (2012). Validating LR(1) Parsers. In: Seidl, H. (eds) Programming Languages and Systems. ESOP 2012. Lecture Notes in Computer Science, vol 7211. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-28869-2_20

Download citation

  • .RIS
  • .ENW
  • .BIB
  • DOI: https://doi.org/10.1007/978-3-642-28869-2_20

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-28868-5

  • Online ISBN: 978-3-642-28869-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Share this paper

Anyone you share the following link with will be able to read this content:

Sorry, a shareable link is not currently available for this article.

Provided by the Springer Nature SharedIt content-sharing initiative

Search

Navigation

  • Find a journal
  • Publish with us

Discover content

  • Journals A-Z
  • Books A-Z

Publish with us

  • Publish your research
  • Open access publishing

Products and services

  • Our products
  • Librarians
  • Societies
  • Partners and advertisers

Our imprints

  • Springer
  • Nature Portfolio
  • BMC
  • Palgrave Macmillan
  • Apress
  • Your US state privacy rights
  • Accessibility statement
  • Terms and conditions
  • Privacy policy
  • Help and support

167.114.118.210

Not affiliated

Springer Nature

© 2023 Springer Nature