Advertisement

An Operational Investigation of the CPS Hierarchy

  • Olivier Danvy
  • Zhe Yang
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1576)

Abstract

We explore the hierarchy of control induced by successive transformations into continuation-passing style (CPS) in the presence of “control delimiters ” and “composable continuations ”. Specifically, we investigate the structural operational semantics associated with the CPS hierarchy.

To this end, we characterize an operational notion of continuation semantics. We relate it to the traditional CPS transformation and we use it to account for the control operator shift and the control delimiter reset operationally. We then transcribe the resulting continuation semantics in ML, thus obtaining a native and modular implementation of the entire hierarchy. We illustrate it with several examples, the most significant of which is layered monads.

Keywords

Control Operator Operational Semantic Derivation Tree Type Soundness Program Language Design 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

References

  1. 1.
    Andrew W. Appel and David B. MacQueen. Standard ML of New Jersey. In Jan Maluszyński and Martin Wirsing, editors, Third International Symposium on Programming Language Implementation and Logic Programming, number 528 in Lecture Notes in Computer Science, pages 1–13, Passau, Germany, August 1991. Springer-Verlag.Google Scholar
  2. 2.
    Robert (Corky) Cartwright, editor. Proceedings of the 1988 ACM Conference on Lisp and Functional Programming, Snowbird, Utah, July 1988. ACM Press.Google Scholar
  3. 3.
    William Clinger, Anne H. Hartheimer, and Eric M. Ost. Implementation strategies for first-class continuations. Higher-Order and Symbolic Computation, 12(1), 1999.Google Scholar
  4. 4.
    Olivier Danvy. Type-directed partial evaluation. In Guy L. Steele Jr., editor, Proceedings of the Twenty-Third Annual ACM Symposium on Principles of Programming Languages, pages 242–257, St. Petersburg Beach, Florida, January 1996. ACM Press.Google Scholar
  5. 5.
    Olivier Danvy and Andrzej Filinski. Abstracting control. In Wand [38], pages 151–160.Google Scholar
  6. 6.
    Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361–391, December 1992.zbMATHMathSciNetGoogle Scholar
  7. 7.
    Olivier Danvy and Zhe Yang. An operational investigation of the CPS hierarchy (extended version). Technical Report BRICS RS-98-35, Department of Computer Science, University of Aarhus, Aarhus, Denmark, December 1998.Google Scholar
  8. 8.
    Matthias Felleisen. The theory and practice of first-class prompts. In Peter MagerProceedings of the Fifteenth Annual ACM Symposium on Principles of Programming Languages, San Diego, California Ferrante and Mager [11], pages 180–190.Google Scholar
  9. 9.
    Matthias Felleisen, Daniel P. Friedman, Bruce Duba, and John Merrill. Beyond continuations. Technical Report 216, Computer Science Department, Indiana University, Bloomington, Indiana, February 1987.Google Scholar
  10. 10.
    Matthias Felleisen, Mitchell Wand, Daniel P. Friedman, and Bruce F. Duba. Abstract continuations: A mathematical semantics for handling full functional jumps. In Cartwright [2], pages 52–62.Google Scholar
  11. 11.
    Jeanne Ferrante and Peter Mager, editors. Proceedings of the Fifteenth Annual ACM Symposium on Principles of Programming Languages, San Diego, California, January 1988. ACM Press.Google Scholar
  12. 12.
    Andrzej Filinski. Representing monads. In Hans-J. Boehm, editor, Proceedings of the Twenty-First Annual ACM Symposium on Principles of Programming Languages, pages 446–457, Portland, Oregon, January 1994. ACM Press.Google Scholar
  13. 13.
    Andrzej Filinski. Controlling Effects. PhD thesis, School of Computer Science, Carnegie Mellon University, Pittsburgh, Pennsylvania, May 1996. Technical Report CMU-CS-96-119.Google Scholar
  14. 14.
    Andrzej Filinski. From normalization-by-evaluation to type-directed partial evaluation. In Olivier Danvy and Peter Dybjer, editors, Preliminary Proceedings of the 1998 APPSEM Workshop on Normalization by Evaluation, NBE’ 98, (Chalmers, Sweden, May 8–9, 1998), number NS-98-1 in BRICS Note Series, Department of Computer Science, University of Aarhus, May 1998.Google Scholar
  15. 15.
    Andrzej Filinski. Representing layered monads. In Alex Aiken, editor, Proceedings of the Twenty-Sixth Annual ACM Symposium on Principles of Programming Languages, San Antonio, Texas, January 1999. ACM Press. To appear.Google Scholar
  16. 16.
    Carl Gunter, Didier Ré my, and Jon G. Riecke. A generalization of exceptions and control in ML-like languages. In Simon Peyton Jones, editor, Proceedings of the Seventh ACM Conference on Functional Programming and Computer Architecture, pages 12–23, La Jolla, California, June 1995. ACM Press.Google Scholar
  17. 17.
    Robert Harper, Bruce F. Duba, and David MacQueen. Typing first-class continuations in ML. Journal of Functional Programming, 3(4):465–484, October 1993.CrossRefGoogle Scholar
  18. 18.
    Robert Hieb and R. Kent Dybvig. Continuations and concurrency. In Proceedings of the Second ACM SIGPLAN Symposium on Principles & Practice of Parallel Programming, SIGPLAN Notices, Vol. 25, No. 3, pages 128–136, Seattle, Washington, March 1990. ACM Press.CrossRefGoogle Scholar
  19. 19.
    Robert Hieb, R. Kent Dybvig, and Claude W. Anderson, III. Subcontinuations. Lisp and Symbolic Computation, 5(4):295–326, December 1993.CrossRefGoogle Scholar
  20. 20.
    Robert Hieb, R. Kent Dybvig, and Carl Bruggeman. Representing control in the presence of first-class continuations. In Bernard Lang, editor, Proceedings of the ACM SIGPLAN’90 Conference on Programming Languages Design and Implementation, SIGPLAN Notices, Vol. 25, No 6, pages 66–77, White Plains, New York, June 1990. ACM Press.Google Scholar
  21. 21.
    Gregory F. Johnson. GL — a denotational testbed with continuations and partial continuations as first-class objects. In Mark Scott Johnson, editor, Proceedings of the ACM SIGPLAN’87 Symposium on Interpreters and Interpretive Techniques, SIGPLAN Notices, Vol. 22, No 7, pages 154–176, Saint-Paul, Minnesota, June 1987. ACM Press.Google Scholar
  22. 22.
    Gregory F. Johnson and Dominic Duggan. Stores and partial continuations as first-class objects in a language and its environment. In Peter MagerProceedings of the Fifteenth Annual ACM Symposium on Principles of Programming Languages, San Diego, California Ferrante and Mager [11], pages 158–168.Google Scholar
  23. 23.
    Richard Kelsey, William Clinger, and Jonathan Rees, editors. Revised5 report on the algorithmic language Scheme. Higher-Order and Symbolic Computation, 11(1):7–105, 1998. Also appears in ACM SIGPLAN Notices 33(9), September 1998.Google Scholar
  24. 24.
    Julia L. Lawall. Continuation Introduction and Elimination in Higher-Order Programming Languages. PhD thesis, Computer Science Department, Indiana University, Bloomington, Indiana, July 1994.Google Scholar
  25. 25.
    Julia L. Lawall and Olivier Danvy. Continuation-based partial evaluation. In Carolyn L. Talcott, editor, Proceedings of the 1994 ACM Conference on Lisp and Functional Programming, LISP Pointers, Vol. VII, No. 3, Orlando, Florida, June 1994. ACM Press.Google Scholar
  26. 26.
    Sheng Liang, Paul Hudak, and Mark Jones. Monad transformers and modular interpreters. In Peter Lee, editor, Proceedings of the Twenty-Second Annual ACM Symposium on Principles of Programming Languages, pages 333–343, San Francisco, California, January 1995. ACM Press.Google Scholar
  27. 27.
    Luc Moreau and Christian Queinnec. Partial continuations as the difference of continuations, a duumvirate of control operators. In Manuel Hermenegildo and Jaan Penjam, editors, Sixth International Symposium on Programming Language Implementation and Logic Programming, number 844 in Lecture Notes in Computer Science, pages 182–197, Madrid, Spain, September 1994. Springer-Verlag.Google Scholar
  28. 28.
    Chethan R. Murthy. Control operators, hierarchies, and pseudo-classical type systems: A-translation at work. In Olivier Danvy and Carolyn L. Talcott, editors, Proceedings of the ACM SIGPLAN Workshop on Continuations, Technical report STAN-CS-92-1426, Stanford University, pages 49–72, San Francisco, California, June 1992.Google Scholar
  29. 29.
    Gordon D. Plotkin. Call-by-name, call-by-value and the λ-calculus. Theoretical Computer Science, 1:125–159, 1975.zbMATHCrossRefMathSciNetGoogle Scholar
  30. 30.
    Todd A. Proebsting. Simple translation of goal-directed evaluation. In Ron K. Cytron, editor, Proceedings of the ACM SIGPLAN'97 Conference on Programming Languages Design and Implementation, SIGPLAN Notices, Vol. 32, No 5, pages 1–6, Las Vegas, Nevada, June 1997. ACM Press.Google Scholar
  31. 31.
    Christian Queinnec and Bernard Serpette. A dynamic extent control operator for partial continuations. In Robert (Corky) Cartwright, editor, Proceedings of the Eighteenth Annual ACM Symposium on Principles of Programming Languages, pages 174–184, Orlando, Florida, January 1991. ACM Press.Google Scholar
  32. 32.
    John C. Reynolds. The discoveries of continuations. Lisp and Symbolic Computation, 6(3/4):233–247, December 1993.CrossRefGoogle Scholar
  33. 33.
    Dorai Sitaram. Handling control. In David W. Wall, editor, Proceedings of the ACM SIGPLAN’93 Conference on Programming Languages Design and Implementation, SIGPLAN Notices, Vol. 28, No 6, pages 147–155, Albuquerque, New Mexico, June 1993. ACM Press.Google Scholar
  34. 34.
    Dorai Sitaram and Matthias Felleisen. Control delimiters and their hierarchies. Lisp and Symbolic Computation, 3(1):67–99, January 1990.CrossRefGoogle Scholar
  35. 35.
    Dorai Sitaram and Matthias Felleisen. Reasoning with continuations II: Full abstraction for models of control. In Wand [38], pages 161–175.Google Scholar
  36. 36.
    Philip Wadler. The essence of functional programming (tutorial). In Andrew W. Appel, editor, Proceedings of the Nineteenth Annual ACM Symposium on Principles of Programming Languages, pages 1–14, Albuquerque, New Mexico, January 1992. ACM Press.Google Scholar
  37. 37.
    Philip Wadler. Monads and composable continuations. LISP and Symbolic Computation, 7(1):39–55, January 1994.CrossRefGoogle Scholar
  38. 38.
    Mitchell Wand, editor. Proceedings of the 1990 ACM Conference on Lisp and Functional Programming, Nice, France, June 1990. ACM Press.Google Scholar
  39. 39.
    Andrew K. Wright and Matthias Felleisen. A syntactic approach to type soundness. Information and Computation, 115:38–94, 1994.zbMATHCrossRefMathSciNetGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1999

Authors and Affiliations

  • Olivier Danvy
    • 1
    • 3
  • Zhe Yang
    • 2
  1. 1.Department of Computer ScienceUniversity of AarhusAarhus CDenmark
  2. 2.Department of Computer ScienceNew York UniversityNew YorkUSA
  3. 3.Basic Research in Computer Science (http://www.brics.dk)Centre of the Danish National Research FoundationDenmark

Personalised recommendations