Hostname: page-component-848d4c4894-p2v8j Total loading time: 0.001 Render date: 2024-05-26T09:19:22.230Z Has data issue: false hasContentIssue false

Calculating correct compilers II: Return of the register machines

Published online by Cambridge University Press:  20 August 2020

IT University of Copenhagen, Denmark (e-mail:
University of Nottingham, UK (e-mail:
Rights & Permissions [Opens in a new window]


Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

In ‘Calculating Correct Compilers’ (Bahr & Hutton, 2015), we developed a new approach to calculating compilers directly from specifications of their correctness. Our approach only required elementary reasoning techniques and has been used to calculate compilers for a wide range of language features and their combination. However, the methodology was focused on stack-based target machines, whereas real compilers often target register-based machines. In this article, we show how our approach can naturally be adapted to calculate compilers for register machines.

Research Article
© The Author(s), 2020. Published by Cambridge University Press


Ager, M. S., Biernacki, D., Danvy, O. & Midtgaard, J. (2003a) A functional correspondence between evaluators and abstract machines. In Proceedings of the 5th ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming.CrossRefGoogle Scholar
Ager, M. S., Biernacki, D., Danvy, O. & Midtgaard, J. (2003b) From Interpreter to Compiler and Virtual Machine: A Functional Derivation. Technical Report RS-03-14. BRICS, Department of Computer Science, University of Aarhus.CrossRefGoogle Scholar
Bahr, P. (2014) Proving correctness of compilers using structured graphs. In Functional and Logic Programming. LNCS, vol. 8475. Springer.CrossRefGoogle Scholar
Bahr, P. & Hutton, G. (2015) Calculating correct compilers. J. Funct. Program. 25.CrossRefGoogle Scholar
Bahr, P. & Hutton, G. (2020) Supplementary Material for Calculating Correct Compilers II. Available at: Scholar
Chaitin, G. (1982) Register allocation & spilling via graph coloring. In Proceedings of the 1982 SIGPLAN Symposium on Compiler Construction.CrossRefGoogle Scholar
Chlipala, A. (2010) A verified compiler for an impure functional language. In Proceedings of the 37th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages.CrossRefGoogle Scholar
Dave, M. (2003) Compiler verification: A bibliography. Soft. Eng. Notes 28(6), 2.CrossRefGoogle Scholar
DeepSpec. (2020) The Science of Deep Specification. Available at: Scholar
Futamura, Y. (1999) Partial evaluation of computation process – An approach to a compiler-compiler. Higher-Order Symb. Comput. 12(4), 381391.CrossRefGoogle Scholar
Hutton, G. & Bahr, P. (2016) Cutting out continuations. In A List of Successes That Can Change the World. Lecture Notes in Computer Science, vol. 9600. Springer.CrossRefGoogle Scholar
Hutton, G. & Bahr, P. (2017) Compiling a 50-year journey. J. Funct. Program. 27.CrossRefGoogle Scholar
Hutton, G. & Wright, J. (2006) Calculating an exceptional machine. In Trends in Functional Programming Volume 5, Loidl, H.-W. (ed). Intellect. Selected papers from the Fifth Symposium on Trends in Functional Programming.Google Scholar
Hutton, G. & Wright, J. (2007) What is the meaning of these constant interruptions? J. Funct. Program. 17(6), 4964.CrossRefGoogle Scholar
Jones, N., Gomard, C. & Sestoft, P. (1993) Partial Evaluation and Automatic Program Generation. Prentice-Hall.Google Scholar
Kumar, R., Myreen, M. O., Norrish, M. & Owens, S. (2014) CakeML: A verified implementation of ML. In Proceedings of the 41st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages.CrossRefGoogle Scholar
Landin, P. J. (1964) The mechanical evaluation of expressions. Comput. J. 6(4), 308320.CrossRefGoogle Scholar
Lattner, C. (2008) Introduction to the LLVM compiler system. In Proceedings of International Workshop on Advanced Computing and Analysis Techniques in Physics Research.Google Scholar
Leroy, X. (2009) Formal verification of a realistic compiler. Commun. ACM 52(7), 107115.CrossRefGoogle Scholar
McCarthy, J. & Painter, J. (1967) Correctness of a compiler for arithmetic expressions. In Mathematical Aspects of Computer Science. Proceedings of Symposia in Applied Mathematics, vol. 19. American Mathematical Society.CrossRefGoogle Scholar
Meijer, E. (1992) Calculating Compilers. PhD Thesis, Katholieke Universiteit Nijmegen.Google Scholar
Meijer, E., Fokkinga, M. & Paterson, R. (1991) Functional programming with bananas, lenses, envelopes and barbed wire. In Functional Programming and Computer Architecture.CrossRefGoogle Scholar
Milner, R. & Weyhrauch, R. (1972) Proving compiler correctness in a mechanized logic. Mach. Intell. 7, 5173.Google Scholar
PEPM. (2020) Workshop on Partial Evaluation and Program Manipulation. Available at: Scholar
Reynolds, J. C. (1972) Definitional interpreters for higher-order programming languages. In Proceedings of the ACM Annual Conference.CrossRefGoogle Scholar
Spivey, M. (1990) A functional theory of exceptions. Sci. Comput. Program. 14(1), 2542.CrossRefGoogle Scholar
Wadler, P. (1992) Monads for functional programming. In Proceedings of the Marktoberdorf Summer School on Program Design Calculi, Broy, M. (ed). Springer–Verlag.CrossRefGoogle Scholar
Wand, M. (1982a) Deriving target code as a representation of continuation semantics. ACM Trans. Program. Lang. Syst. 4(3), 496517.Google Scholar
Wand, M. (1982b) Semantics-directed machine architecture. In Principles of Programming Languages.CrossRefGoogle Scholar
Supplementary material: File

Bahr and Hutton supplementary material

Bahr and Hutton supplementary material

Download Bahr and Hutton supplementary material(File)
File 222.2 KB
Submit a response


No Discussions have been published for this article.