skip to main content
10.1145/174675.178053acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
Article
Free Access

A generic account of continuation-passing styles

Authors Info & Claims
Published:01 February 1994Publication History

ABSTRACT

We unify previous work on the continuation-passing style (CPS) transformations in a generic framework based on Moggi's computational meta-language. This framework is used to obtain CPS transformations for a variety of evaluation strategies and to characterize the corresponding administrative reductions and inverse transformations. We establish generic formal connections between operational semantics and equational theories. Formal properties of transformations for specific evaluation orders follow as corollaries.

Essentially, we factor transformations through Moggi's computational m eta-language. Mapping λ-terms into the meta-language captures computation properties (e.g., partiality, strictness) and evaluation order explicitly in both the term and the type structure of the meta-language. The CPS transformation is then obtained by applying a generic transformation from terms and types in the meta-language to CPS terms and types, based on a typed term representation of the continuation monad. We prove an adequacy property for the generic transformation and establish an equational correspondence between the meta-language and CPS terms.

These generic results generalize Plotkin's seminal theorems, subsume more recent results, and enable new uses of CPS transformations and their inverses. We discuss how to aply these results to compilation.

References

  1. 1.Andrew W. Appel. Compiling with Continuations. Cambridge University Press, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. 2.Henk Barendregt. The Lambda Calculus -- Its Syntax and Semantics. North-Holland, 1984.Google ScholarGoogle Scholar
  3. 3.Geoffrey Burn and Daniel Le M~tayer. Proving the correctness of compiler optimisations based on a global program analysis. Technical report Doc 92/20, Department of Computing, Imperial College of Science, Technology and Medicine, London, England, 1992.Google ScholarGoogle Scholar
  4. 4.William Clinger, editor. Proceed, ngs of the 1992 A CM Conference on Lisp and Functional Programmzng, LISP Pointers, Vol. V, No. 1, San Francisco, California, June 1992. ACM Press.Google ScholarGoogle Scholar
  5. 5.Olivier Danvy. Three steps for the CPS transformation. Technical Report CIS-92-2, Kansas State University, Manhattan, Kansas, December 1991.Google ScholarGoogle Scholar
  6. 6.Olivier Danvy. Back to direct style. Science of Computer Programm,ng, 1993. Special issue on ESOP'92, the Fourth European Symposium on Programming, Rennes, February 26-28, 1992. To appear. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. 7.Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. In Wand {44}, pages 361-391.Google ScholarGoogle Scholar
  8. 8.OIivier Danvy and John Hatcliff. CPS transformation. after strictness analysis. A CM Letters on Programming Languages and Systems, 1(3):195-212, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. 9.Olivier Danvy and John Hatcliff. On the transformation between direct and continuation semantics. In Stephen Brookes, Michael Main, Austin Melton, Michael Mislove, and David Schmidt, editors, Proceedings of the 9th Conference on Mathematical Foundations of Programming Semantics, Lecture Notes in Computer Science, New Orleans, Louisiana, April 1993. To appear. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. 10.Olivier Danvy and Julia L. Lawall. Back to direct style iI: First-class continuations. In Clinger {4}, pages 299- 310. Google ScholarGoogle Scholar
  11. 11.Matthias Felleisen and Daniel P. Friedman. Control operators, the SECD machine, and the A-calculus. In M. Wirsing, editor, Formal Description of Programming Concepts III, pages 193-217. North-Holland, 1986.Google ScholarGoogle Scholar
  12. 12.Michael J. Fischer. Lambda-calculus schemata. In Talference on Proving Assertions about Programs, SIG- PLAN Notices, Vol. 7, No. 1, January 1972. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. 13.Cormac Flanagan, Amr Sabry, Bruce F. Duba, and Matthias FeUeisen. The essence of compiling with continuations. In David W. Wall, editor, Proceedings of the A CM SIGPLAN'93 Conference on Programming Languages Design and Implementation, SIGPLAN Notices, Vol. 28, No 6, pages 237-247, Albuquerque, New Mexico, June 1993. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. 14.Timothy G. Griffin. A formulae-as-types notion of control. In Paul Hudak, editor, Proceedings of the Seventeenth Annual A CM Symposium on Principles o:f Programming Languages, pages 47-58, San Francisco, California, January 1990. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. 15.Bob Harper ~rtd Mark Lilhbridgc. Polymorphic type assignment and CPS conversion. In Talcott {39}. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. 16.John Hatcliff. PhD thesis, Department of Computing and Information Sciences, Kansas State University, Manhattan, Kansas, USA, March 1994. Forthcoming.Google ScholarGoogle Scholar
  17. 17.John Hatcliff and Ohvier Danvy. Thunks and the )~- calculus. Technical Report CIS-93-15, Kansas State University, Manhattan, Kansas, September 1993.Google ScholarGoogle Scholar
  18. 18.Peter Z. Ingerm~n. Thunks, a way of compiling procedure statements with some comments on procedure declarations. Communications of the A CM, 4(1):55-58, 1961. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. 19.Jufia L. Lawall. PhD thesis, Computer Science Department, Indiana University, Bloomington, Indiana, USA, 1993. Forthcoming.Google ScholarGoogle Scholar
  20. 20.Julia L. LawaI1. Proofs by structural induction using partial evaluation. In David A. Schmidt, editor, Proceedings of the Second A CM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation, pages 155-166, Copenhagen, Denmark, June 1993. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. 21.Julia L. Lawall and Olivier Danvy. Separating stages in the continuation-passing style transformation, in Susan L. Graham, editor, Proceedings of the Twentieth Annual A CM Symposium on Principles of Programming Languages, pages 124-136, Charleston, South Carolina, January 1993. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. 22.Albert R. Meyer and Mitchell Wand. Continuation semantics in typed lambda-calculi (summary). In Rohit Parikh, editor, Logics of Programs- Proceedings, number 193 in Lecture Notes in Computer Science, pages 219-224, Brooklyn, June 1985. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. 23.Eugenio Moggi. Computational lambda-calculus and monads. Report ECS-LFCS-88-66, University of Edinburgh, Edinburgh, Scotland, October 1988.Google ScholarGoogle Scholar
  24. 24.Eugenio Moggi. Computational lambda-calculus and monads. In Proceedings of the Fourth Annual IEEE Symposium on Logic in Computer Science, pages 14-23, Pacific Grove, California, June 1989. IEEE Computer Society Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. 25.Eugenio Moggi. An abstract view of programming languages. Course notes ECS-LFCS-90-113, Laboratory for Foundations of Computer Science, Department of Computer Science, University of Edinburgh, Edinburgh, Scotland, April 1990.Google ScholarGoogle Scholar
  26. 26.Eugenio Moggi. Notions of computation and monads. Information and Computation, 93:55-92, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. 27.Luc Moreau and Daniel Ribbens. Sound rules for parallel evaluation of a functional language with callcc. In Arvind, editor, Proceedings of the Sixth A CM Conference on Functional Programming and Computer Architecture, pages 125-135, Copenhagen, Denmark, June 1993. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. 28.Chetan R. Murthy. Extracting Constructive Content from Classical Proofs. PhD thesis, Department of Computer Science, Cornell University, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. 29.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 ScholarGoogle ScholarDigital LibraryDigital Library
  30. 30.Peter Naur (editor). Revised report on the algorithmic language Algol 60. Communications of the A CM, 6(1):1-17, 1962. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. 31.Chris Okasaki, Peter Lee, and David Tarditi. Call-byneed and continuation-passing style. In Talcott {39}.Google ScholarGoogle Scholar
  32. 32.Gordon D. Plotkin. Call-by-name, call-by-value and the )~-calculus. Theoretical Computer Science, 1:125-159, 1975.Google ScholarGoogle ScholarCross RefCross Ref
  33. 33.John C. Reynolds. Definitional interpreters for higherorder programming languages. In Proceedings of 25th A CM National Conference, pages 717-740, Boston, 1972. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. 34.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, Saarbriicken, West Germany, July 1974. Google ScholarGoogle Scholar
  35. 35.Amr Snbry ~md Matthias Felleisen. Reasoning about programs in continuation-passing style. In Clinger {4}, pages 288-298. Google ScholarGoogle Scholar
  36. 36.Amr Sabry and Matthias Felleisen. Reasoning about programs in continuation-passing style. In Talcott {39}. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. 37.Amr Sabry and John Field. Reasoning about explicit and implicit representation of state. In Paul Hudak, editor, Proceedings of the A CM SIGPLAN Workshop on State in Programming Languages, pages 17-30, Copenhagen, Denmark, June 1993.Google ScholarGoogle Scholar
  38. 38.David A. Schmidt. Denotational Semantics: A Methodology for Language Development. Altyn and Bacon, Inc., 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. 39.Carolyn L. Talcott, editor. Special issue on continuations, LISP and Symbolic Computation, Vol. 6, Nos. 3/4. Kluwer Academic Publishers, 1993.Google ScholarGoogle Scholar
  40. 40.Robert D. Tennent. Semantics of Programming Languages. Prentice-Hall International, Englewood Cliffs, New Jersey, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. 41.Philip Wadler. Comprehending monads. In Wand {44}, pages 461-493. Google ScholarGoogle Scholar
  42. 42.Philip Wadler. The essence of functional programming (tutorial). In Andrew W. Appel, editor, Proceedings of the Nineteenth Annual A CM Symposium on Principles of Programming Languages, pages 1-14, Albuquerque, New Mexico, January 1992. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. 43.Mitchell Wand. Correctness of procedure representations in higher-order assembly language. In Stephen Brookes, Michael Main, Austin Melton, Michael Mislove, and David Schmidt, editors, Mathematical Foundations of Programming Semantics, volume 598 of Lecture Notes in Computer Science, pages 294-311, Pittsburgh, Pennsylwtnia, March 1991. 7th International Conference. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. 44.Mitchell Wand, editor. Special issue on the 1990 A CM Conference on Lisp and Functional Programming, Mathematical Structures in Computer Science, Vol. 2, No. 4. Cambridge University Press, December 1992.Google ScholarGoogle Scholar

Index Terms

  1. A generic account of continuation-passing styles

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in
    • Published in

      cover image ACM Conferences
      POPL '94: Proceedings of the 21st ACM SIGPLAN-SIGACT symposium on Principles of programming languages
      February 1994
      492 pages
      ISBN:0897916360
      DOI:10.1145/174675

      Copyright © 1994 ACM

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 1 February 1994

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • Article

      Acceptance Rates

      POPL '94 Paper Acceptance Rate39of173submissions,23%Overall Acceptance Rate824of4,130submissions,20%

      Upcoming Conference

      POPL '25

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader