Certified Parsing of Regular Languages

  • Denis Firsov
  • Tarmo Uustalu
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8307)


We report on a certified parser generator for regular languages using the Agda programming language. Specifically, we programmed a transformation of regular expressions into a Boolean-matrix based representation of nondeterministic finite automata (NFAs). And we proved (in Agda) that a string matches a regular expression if and only if the NFA accepts it. The proof of the if-part is effectively a function turning acceptance of a string into a parse tree while the only-if part gives a function turning rejection into a proof of impossibility of a parse tree.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Braibant, T., Pous, D.: An efficient Coq tactic for deciding Kleene algebras. In: Kaufmann, M., Paulson, L.C. (eds.) ITP 2010. LNCS, vol. 6172, pp. 163–178. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  2. 2.
    Coquand, T., Siles, V.: A decision procedure for regular expression equivalence in type theory. In: Jouannaud, J.-P., Shao, Z. (eds.) CPP 2011. LNCS, vol. 7086, pp. 119–134. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  3. 3.
    Danielsson, N.A.: Total parser combinators. In: Proc. of 15th ACM SIGPLAN Int. Conf. on Functional Programming, ICFP 2010, pp. 285–296. ACM (2010)Google Scholar
  4. 4.
    Grune, D.: Parsing Techniques: A Practical Guide, 2nd edn. Springer (2010)Google Scholar
  5. 5.
    Krauss, A., Nipkow, T.: Proof pearl: Regular expression equivalence and relation algebra. J. of Autom. Reasoning 49(1), 95–106 (2012)MathSciNetCrossRefMATHGoogle Scholar
  6. 6.
    Macedo, H.D., Oliveira, J.N.: Typing linear algebra: A biproduct-oriented approach. Sci. of Comput. Program. 78(11), 2160–2191 (2013)CrossRefGoogle Scholar
  7. 7.
    Morrisett, G., Tan, G., Tassarotti, J., Tristan, J.B., Gan, E.: Rocksalt: better, faster, stronger SFI for the x86. In: Proc. of 33rd ACM SIGPLAN Conf. on Programming Language Design and Implementation, PLDI 2012, pp. 395–404. ACM (2012)Google Scholar
  8. 8.
    Norell, U.: Dependently typed programming in Agda. In: Koopman, P., Plasmeijer, R., Swierstra, D. (eds.) AFP 2008. LNCS, vol. 5832, pp. 230–266. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  9. 9.
    Wu, C., Zhang, X., Urban, C.: A formalisation of the Myhill-Nerode theorem based on regular expressions (Proof pearl). In: van Eekelen, M., Geuvers, H., Schmaltz, J., Wiedijk, F. (eds.) ITP 2011. LNCS, vol. 6898, pp. 341–356. Springer, Heidelberg (2011)CrossRefGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2013

Authors and Affiliations

  • Denis Firsov
    • 1
  • Tarmo Uustalu
    • 1
  1. 1.Institute of CyberneticsTallinn University of TechnologyTallinnEstonia

Personalised recommendations