Proving Correctness of Compilers Using Structured Graphs

  • Patrick Bahr
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8475)


We present an approach to compiler implementation using Oliveira and Cook’s structured graphs that avoids the use of explicit jumps in the generated code. The advantage of our method is that it takes the implementation of a compiler using a tree type along with its correctness proof and turns it into a compiler implementation using a graph type along with a correctness proof. The implementation and correctness proof of a compiler using a tree type without explicit jumps is simple, but yields code duplication. Our method provides a convenient way of improving such a compiler without giving up the benefits of simple reasoning.


Virtual Machine Structure Graph Target Language Proof Obligation Correctness Proof 
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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [Ager et al.(2003)Ager, Biernacki, Danvy, and Midtgaard.]
    Ager, M.S., Biernacki, D., Danvy, O., Midtgaard, J.: From interpreter to compiler and virtual machine: A functional derivation. Tech. Rep. RS-03-14, BRICS, Department of Computer Science, University of Aarhus (2003)Google Scholar
  2. [Bahr(2014)]
    Bahr, P.: Proving correctness of compilers using structured graphs (extended version). Tech. rep., University of Copenhagen (2014)Google Scholar
  3. [Bahr and Hutton(2014)]
    Bahr, P., Hutton, G.: Calculating correct compilers (2014) (unpublished manuscript)Google Scholar
  4. [Bernardy and Pouillard(2013)]
    Bernardy, J.P., Pouillard, N.: Names for free: polymorphic views of names and binders. In: Proceedings of the 2013 ACM SIGPLAN Symposium on Haskell, pp. 13–24. ACM (2013)Google Scholar
  5. [Chlipala(2008)]
    Chlipala, A.: Parametric higher-order abstract syntax for mechanized semantics. In: Proceeding of the 13th ACM SIGPLAN International Conference on Functional Programming, pp. 143–156. ACM (2008)Google Scholar
  6. [Chlipala(2010)]
    Chlipala, A.: A verified compiler for an impure functional language. In: Proceedings of the 37th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 93–106. ACM (2010)Google Scholar
  7. [Dave(2003)]
    Dave, M.A.: Compiler verification: a bibliography. SIGSOFT Softw. Eng. Notes 28(6), 2 (2003)CrossRefGoogle Scholar
  8. [Gill et al.(1993)Gill, Launchbury, and Peyton Jones]
    Gill, A., Launchbury, J., Peyton Jones, S.L.: A short cut to deforestation. In: Proceedings of the Conference on Functional Programming Languages and Computer Architecture, pp. 223–232. ACM (1993)Google Scholar
  9. [Hutton(2007)]
    Hutton, G.: Programming in Haskell, vol. 2. Cambridge University Press, Cambridge (2007)CrossRefzbMATHGoogle Scholar
  10. [Hutton and Wright(2004)]
    Hutton, G., Wright, J.: Compiling exceptions correctly. In: Kozen, D. (ed.) MPC 2004. LNCS, vol. 3125, pp. 211–227. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  11. [Hutton and Wright(2007)]
    Hutton, G., Wright, J.: What is the meaning of these constant interruptions? J. Funct. Program. 17(6), 777–792 (2007)zbMATHMathSciNetGoogle Scholar
  12. [Johann(2002)]
    Johann, P.: A generalization of short-cut fusion and its correctness proof. Higher Order Symbol. Comput. 15(4), 273–300 (2002)CrossRefzbMATHGoogle Scholar
  13. [Leroy(2006)]
    Leroy, X.: Formal certification of a compiler back-end or: programming a compiler with a proof assistant. In: Conference record of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 42–54. ACM (2006)Google Scholar
  14. [Marlow(2010)]
    Marlow, S.: Haskell 2010 language report (2010)Google Scholar
  15. [Matsuda et al.(2012)Matsuda, Inaba, and Nakano]
    Matsuda, K., Inaba, K., Nakano, K.: Polynomial-time inverse computation for accumulative functions with multiple data traversals. In: Proceedings of the ACM SIGPLAN 2012 Workshop on Partial Evaluation and Program Manipulation, pp. 5–14. ACM (2012)Google Scholar
  16. [Meijer(1992)]
    Meijer, E.: Calculating Compilers. Ph.D. thesis, Katholieke Universiteit Nijmegen (1992)Google Scholar
  17. [Oliveira and Löh(2013)]
    Oliveira, B.C.D.S., Löh, A.: Abstract syntax graphs for domain specific languages. In: Proceedings of the ACM SIGPLAN 2013 Workshop on Partial Evaluation and Program Manipulation, pp. 87–96. ACM (2013)Google Scholar
  18. [Oliveira and Cook(2012)]
    Oliveira, B.C., Cook, W.R.: Functional programming with structured graphs. In: Proceedings of the 17th ACM SIGPLAN International Conference on Functional Programming, pp. 77–88. ACM (2012)Google Scholar
  19. [Ramsey et al.(2010)Ramsey, Dias, and Peyton Jones]
    Ramsey, N., Dias, J.A., Peyton Jones, S.: Hoopl: a modular, reusable library for dataflow analysis and transformation. In: Proceedings of the Third ACM Haskell Symposium on Haskell, pp. 121–134. ACM (2010)Google Scholar
  20. [Ramsey and Dias(2006)]
    Ramsey, N., Dias, J.: An applicative control-flow graph based on huet’s zipper. In: Proceedings of the ACM-SIGPLAN Workshop on ML, pp. 105–126 (2006)Google Scholar
  21. [Wand(1982)]
    Wand, M.: Deriving target code as a representation of continuation semantics. ACM Trans. Program. Lang. Syst. 4(3), 496–517 (1982)CrossRefzbMATHGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2014

Authors and Affiliations

  • Patrick Bahr
    • 1
  1. 1.Department of Computer ScienceUniversity of CopenhagenDenmark

Personalised recommendations