Automatically introducing tail recursion in CakeML
Paper i proceeding, 2018

We describe and implement an optimizing compiler transformation which turns non–tail-recursive functions into equivalent tail-recursive functions in an intermediate language of the CakeML compiler. CakeML is a strongly typed functional language based on Standard ML with call-by-value semantics and a fully verified compiler. We integrate our implementation into CakeML compiler, and provide a machine-checked proof verifying that the observational semantics of programs is preserved under the transformation. To the best of our knowledge, this is the first fully verified implementation of this transformation in any modern compiler. Moreover, our verification efforts uncover surprising drawbacks in some of the verification techniques employed in several parts of the CakeML compiler. We provide a work-around for these drawbacks, and compare it to potential alternatives.


Oskar Abrahamsson

Chalmers, Data- och informationsteknik, Formella metoder

Magnus Myreen

Chalmers, Data- och informationsteknik, Formella metoder

Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)

03029743 (ISSN) 16113349 (eISSN)

Vol. 10788 118-134
978-3-319-89718-9 (ISBN)

18th International Symposium on Trends in Functional Programming, TFP 2017
Canterbury, United Kingdom,


Språkteknologi (språkvetenskaplig databehandling)


Matematisk analys



Mer information

Senast uppdaterat