Advertisement

Cutting Out Continuations

  • Graham Hutton
  • Patrick Bahr
Chapter
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9600)

Abstract

In the field of program transformation, one often transforms programs into continuation-passing style to make their flow of control explicit, and then immediately removes the resulting continuations using defunctionalisation to make the programs first-order. In this article, we show how these two transformations can be fused together into a single transformation step that cuts out the need to first introduce and then eliminate continuations. Our approach is calculational, uses standard equational reasoning techniques, and is widely applicable.

Notes

Acknowledgements

We thank the anonymous reviewers for their comments and suggestions.

References

  1. 1.
    Ager, M.S., Biernacki, D., Danvy, O., Midtgaard, J.: A functional correspondence between evaluators and abstract machines. In: Proceedings of the 5th ACM SIGPLAN International Conference on Principles and Practice of Declaritive Programming (2003)Google Scholar
  2. 2.
    Ager, M.S., Biernacki, D., Danvy, O., Midtgaard, J.: From interpreter to compiler and virtual machine: a functional derivation. Technical report RS-03-14, BRICS, Department of Computer Science, University of Aarhus (2003)Google Scholar
  3. 3.
    Ager, M.S., Danvy, O., Midtgaard, J.: A functional correspondence between call-by-need evaluators and lazy abstract machines. Inf. Process. Lett. 90(5), 223–232 (2004)MathSciNetCrossRefzbMATHGoogle Scholar
  4. 4.
    Backhouse, R.: Program Construction: Calculating Implementations from Specifications. Wiley, New York (2003)Google Scholar
  5. 5.
    Bahr, P., Hutton, G.: Calculating correct compilers. J. Funct. Program. 25, 47 (2015)MathSciNetCrossRefGoogle Scholar
  6. 6.
    Felleisen, M., Friedman, D.P.: Control operators, the SECD machine, and the \(\lambda \)-calculus. In: Wirsing, M. (ed.) Formal Description of Programming Concepts III, pp. 193–217. Elsevier Science Publishers B.V., Amsterdam (1986)Google Scholar
  7. 7.
    Hutton, G., Bahr, P.: Associated Coq proofs. http://github.com/pa-ba/cps-defun
  8. 8.
    Hutton, G., Wright, J.: Calculating an exceptional machine. In: Loidl, H.W. (ed.) Trends in Functional Programming. Intellect, February 2006Google Scholar
  9. 9.
    Krivine, J.L.: Un Interpréteur du Lambda-calcul (1985). Unpublished manuscriptGoogle Scholar
  10. 10.
    Landin, P.J.: The mechanical evaluation of expressions. Comput. J. 6(4), 308–320 (1964)CrossRefzbMATHGoogle Scholar
  11. 11.
    Meijer, E.: Calculating compilers. Ph.D. thesis, Katholieke Universiteit Nijmegen (1992)Google Scholar
  12. 12.
    Reynolds, J.C.: Definitional interpreters for higher-order programming languages. In: Proceedings of the ACM Annual Conference, pp. 717–740 (1972)Google Scholar
  13. 13.
    Wand, M.: Deriving target code as a representation of continuation semantics. ACM Trans. Program. Lang. Syst. 4(3), 496–517 (1982)CrossRefzbMATHGoogle Scholar
  14. 14.
    Winskel, G.: The Formal Semantics of Programming Languages - An Introduction. Foundation of Computing Series. MIT Press, Cambridge (1993)zbMATHGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2016

Authors and Affiliations

  1. 1.University of NottinghamNottinghamUK
  2. 2.IT University of CopenhagenCopenhagenDenmark

Personalised recommendations