Skip to main content

On the transformation between direct and continuation semantics

  • Conference paper
  • First Online:
Mathematical Foundations of Programming Semantics (MFPS 1993)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 802))

Abstract

Proving the congruence between a direct semantics and a continuation semantics is often surprisingly complicated considering that direct-style λ-terms can be transformed into continuation style automatically. However, transforming the representation of a direct-style semantics into continuation style usually does not yield the expected representation of a continuation-style semantics (i.e., one written by hand).

The goal of our work is to automate the transformation between textual representations of direct semantics and of continuation semantics. Essentially, we identify properties of a direct-style representation (e.g., totality), and we generalize the transformation into continuation style accordingly. As a result, we can produce the expected representation of a continuation semantics, automatically. It is important to understand the transformation between representations of direct and of continuation semantics because it is these representations that get processed in any kind of semantics-based program manipulation (e.g., compiling, compiler generation, and partial evaluation). A tool producing a variety of continuation-style representations is a valuable new one in a programming-language workbench.

9th Conference on Mathematical Foundations of Programming Semantics. New Orleans, Louisiana, April 1993.

This work was initiated at Kansas State University, continued at Carnegie Mellon University, and completed at Aarhus University. It was partly supported by NSF under grant CCR-9102625.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. William Clinger, editor. Proceedings of the 1992 ACM Conference on Lisp and Functional Programming, LISP Pointers, Vol. V, No. 1, San Francisco, California, June 1992. ACM Press.

    Google Scholar 

  2. Charles Consel and Olivier Danvy. For a better support of static data flow. In John Hughes, editor, Proceedings of the Fifth ACM Conference on Functional Programming and Computer Architecture, number 523 in Lecture Notes in Computer Science, pages 496–519, Cambridge, Massachusetts, August 1991.

    Google Scholar 

  3. Charles Consel and Olivier Danvy. Tutorial notes on partial evaluation. In Graham [8], pages 493–501.

    Google Scholar 

  4. Olivier Danvy. Back to direct style. In Bernd Krieg-Brückner, editor, Proceedings of the Fourth European Symposium on Programming, number 582 in Lecture Notes in Computer Science, pages 130–150, Rennes, France, February 1992. Extended version to appear in Science of Computer Programming.

    Google Scholar 

  5. Olivier Danvy and John Hatcliff. CPS transformation after strictness analysis. ACM Letters on Programming Languages and Systems, 1(3):195–212, 1993.

    Google Scholar 

  6. Olivier Danvy and Julia L. Lawall. Back to direct style II: First-class continuations. In Clinger [1], pages 299–310.

    Google Scholar 

  7. Michael J. Fischer. Lambda calculus schemata. In Talcott [33]. An earlier version appeared in an ACM Conference on Proving Assertions about Programs, SIGPLAN Notices, Vol. 7, No. 1, January 1972.

    Google Scholar 

  8. Susan L. Graham, editor. Proceedings of the Twentieth Annual ACM Symposium on Principles of Programming Languages, Charleston, South Carolina, January 1993. ACM Press.

    Google Scholar 

  9. Bob Harper and Mark Lillibridge. Polymorphic type assignment and CPS conversion. In Talcott [33].

    Google Scholar 

  10. John Hatcliff. PhD thesis, Department of Computing and Information Sciences, Kansas State University, Manhattan, Kansas, USA, March 1994. Forthcoming.

    Google Scholar 

  11. John Hatcliff and Olivier Danvy. A generic account of continuation-passing styles. In Hans-J. Boehm, editor, Proceedings of the Twenty-First Annual ACM Symposium on Principles of Programming Languages, Portland, Oregon, January 1994. ACM Press. To appear.

    Google Scholar 

  12. Julia L. Lawall and Olivier Danvy. Separating stages in the continuation-passing style transformation. In Graham [8], pages 124–136.

    Google Scholar 

  13. Peter Lee. Realistic Compiler Generation. MIT Press, 1989.

    Google Scholar 

  14. Peter Lee and Uwe Pleban. On the use of LISP in implementing denotational semantics. In William L. Scherlis and John H. Williams, editors, Proceedings of the 1986 ACM Conference on Lisp and Functional Programming, pages 233–248, Cambridge, Massachusetts, August 1986.

    Google Scholar 

  15. Albert R. Meyer and Mitchell Wand. Continuation semantics in typed lambdacalculi (summary). In Rohit Parikh, editor, Logics of Programs — Proceedings, number 193 in Lecture Notes in Computer Science, pages 219–224, Brooklyn, June 1985.

    Google Scholar 

  16. Robert E. Milne and Christopher Strachey. A Theory of Programming Language Semantics. Chapman and Hall, London, and John Wiley, New York, 1976.

    Google Scholar 

  17. Eugenio Moggi. Notions of computation and monads. Information and Computation, 93:55–92, 1991.

    Google Scholar 

  18. Margaret Montenyohl and Mitchell Wand. Correct flow analysis in continuation semantics. In Jeanne Ferrante and Peter Mager, editors, Proceedings of the Fifteenth Annual ACM Symposium on Principles of Programming Languages, pages 204–218, San Diego, California, January 1988.

    Google Scholar 

  19. Peter D. Mosses. Action Semantics, volume 26 of Cambridge Tracts in Theoretical Computer Science. Cambridge University Press, 1992.

    Google Scholar 

  20. Alan Mycroft. The theory and practice of transforming call-by-need into call-by-value. In Bernard Robinet, editor, Proceedings of the Fourth International Symposium on Programming, number 83 in Lecture Notes in Computer Science, pages 269–281, Paris, France, April 1980.

    Google Scholar 

  21. Alan Mycroft. Abstract Interpretation and Optimising Transformations for Applicative Programs. PhD thesis, University of Edinburgh, Edinburgh, Scotland, 1981.

    Google Scholar 

  22. Flemming Nielson and Hanne Riis Nielson. Two-level semantics and code generation. Theoretical Computer Science, 56(1):59–133, January 1988. Special issue on ESOP'86, the First European Symposium on Programming, Saarbrücken, March 17–19, 1986.

    Google Scholar 

  23. Flemming Nielson and Hanne Riis Nielson. Two-Level Functional Languages, volume 34 of Cambridge Tracts in Theoretical Computer Science. Cambridge University Press, 1992.

    Google Scholar 

  24. Gordon D. Plotkin. Call-by-name, call-by-value and the λ-calculus. Theoretical Computer Science, 1:125–159, 1975.

    Google Scholar 

  25. John C. Reynolds. Definitional interpreters for higher-order programming languages. In Proceedings of 25th ACM National Conference, pages 717–740, Boston, 1972.

    Google Scholar 

  26. John C. Reynolds. On the relation between direct and continuation semantics. In Jacques Loeckx, editor, 2nd Colloquium on Automata, Languages and Programming, number 14 in Lecture Notes in Computer Science, pages 141–156, Saarbrücken, West Germany, July 1974.

    Google Scholar 

  27. Amr Sabry and Matthias Felleisen. Reasoning about programs in continuationpassing style. In Clinger [1], pages 288–298.

    Google Scholar 

  28. David A. Schmidt. Denotational Semantics: A Methodology for Language Development. Allyn and Bacon, Inc., 1986.

    Google Scholar 

  29. Peter Sestoft. Replacing function parameters by global variables. In Joseph E. Stoy, editor, Proceedings of the Fourth International Conference on Functional Programming and Computer Architecture, pages 39–53, London, England, September 1989. ACM Press.

    Google Scholar 

  30. Olin Shivers. Control-Flow Analysis of Higher-Order Languages or Taming Lambda. PhD thesis, CMU, Pittsburgh, Pennsylvania, May 1991. Technical Report CMU-CS-91-145.

    Google Scholar 

  31. Joseph E. Stoy. Denotational Semantics: The Scott-Strachey Approach to Programming Language Theory. MIT Press, 1977.

    Google Scholar 

  32. Christopher Strachey and Christopher P. Wadsworth. Continuations: A mathematical semantics for handling full jumps. Technical Monograph PRG-11, Oxford University Computing Laboratory, Programming Research Group, Oxford, England, 1974.

    Google Scholar 

  33. Carolyn L. Talcott, editor. Special issue on continuations, LISP and Symbolic Computation, Vol. 6, Nos. 3/4. Kluwer Academic Publishers, 1993.

    Google Scholar 

  34. Robert D. Tennent. Semantics of Programming Languages. Prentice-Hall International, Englewood Cliffs, New Jersey, 1991.

    Google Scholar 

  35. David Watt. Programming Languages Concepts and Paradigms. Prentice-Hall, Englewood Cliffs, New Jersey, 1990.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Stephen Brookes Michael Main Austin Melton Michael Mislove David Schmidt

Rights and permissions

Reprints and permissions

Copyright information

© 1994 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Danvy, O., Hatcliff, J. (1994). On the transformation between direct and continuation semantics. In: Brookes, S., Main, M., Melton, A., Mislove, M., Schmidt, D. (eds) Mathematical Foundations of Programming Semantics. MFPS 1993. Lecture Notes in Computer Science, vol 802. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-58027-1_31

Download citation

  • DOI: https://doi.org/10.1007/3-540-58027-1_31

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-58027-0

  • Online ISBN: 978-3-540-48419-6

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics