Skip to main content
    • Aa
    • Aa

Representing Control: a Study of the CPS Transformation

  • Oliver Danvy (a1) and Andrzex Filinski (a2)

This paper investigates the transformation of λν-terms into continuation-passing style (CPS). We show that by appropriate η-expansion of Fisher and Plotkin's two-pass equational specification of the CPS transform, we can obtain a static and context-free separation of the result terms into “essential” and “administrative” constructs. Interpreting the former as syntax builders and the latter as directly executable code, We obtain a simple and efficient one-pass transformation algorithm, easily extended to conditional expressions, recursive definitions, and similar constructs. This new transformation algorithm leads to a simpler proof of Plotkin's simulation and indifference results.

We go on to show how CPS-based control operators similar to, more general then, Scheme's call/cc can be naturally accommodated by the new transformation algorithm. To demonstrate the expressive power of these operators, we use them to present an equivalent but even more concise formulation of the efficient CPS transformation algorithm. Finally, we relate the fundamental ideas underlying this derivation to similar concepts from other work on program manipulation; we derive a one-pass CPS transformation of λn-terms; and we outline some promising areas for future research.

Linked references
Hide All

This list contains references from the content that can be linked to their source. For a full set of references and notes please see the PDF or HTML where available.

A. Bondorf (1991) Automatic autoprojection of higher-order recursive equations. Science of Computer Programming 17 334.

A. Bondorf and O. Danvy (1991) Automatic autoprojection of recursive equations with global variables and abstract data types. Science of Computer Programming 16 151195.

W. Clinger (1984) The Scheme 311 compiler, an excercise in Denotational Semantics. In: Conference Record of the 1984 ACM Symposium on Lisp and Functional Programming, Austin, Texas356364.

O. Danvy and A. Filinski (1990) Abstracting control. In: Proceedings of the 1990 ACM Conference on Lisp and Functional Programming, Nice, France, 151160.

O. Danvy and J. L. Lawall (1992) Back to direct style II: First-class continuations. In: Proceedings of the 1992 ACM Conference on Lisp and Functional Programming, San Fransisco, California.

M. Felleisen , D.P. Friedman , E. Kohlbecker , and B. Duba (1987b) A syntactic theory of sequential control. Theoretical Computer Science 52(3) 205237.

M. Felleisen M. Wand , D.P. Friedman and B. F. Duba (1988) Abstract continuations: A mathematical semantics for handling full functional jumps. In: Proceedings of the 1988 ACM Conference on Lisp and Functional Programming, Snowbird, Utah, 5262.

P. Fradet and D. Le Métayer (1991) Compilation of functional languages by transformation. ACM Transactions on Programming Languages and Systems 13 2151.

N. D. Jones , P. Sestoft , and H. Søndergaard (1989) MIX: A self-applicable partial evaluator for experiments in compiler generation. LISP and Symbolic Computation 2(1) 950.

E. Moggi (1989) Computational lambda-calculas and monads. In: Proceedings of the Fourth Annual Symposium on Logic in Computer Science, Pacific Grove, California, IEEE, 1423.

F. Nielson (1989) Two-level semantics and abstract interpretaion. Theoretical Computer Science 69(2) 117242.

F. Nielson and H. R. Nielson (1988) Two-level semantics and code generation. Theoretical Computer Science 56(1) 59133.

G. D. Plotkin (1975) Call-by-name, call-by-value and the λ-calculas. Theoretical Computer Science 1 125159.

O. Shivers (1991) The semantics of Scheme control-flow analysis. In: P. Hudak and N. D. Jones ., editors, Symposium on Partial Evaluation and Semantics-Based Program Manipulation. SIGPLAN Notices 26 (9), ACM Press, New Haven, Connecticut. 190198.

M. Wand (1991) Correctness of procedure representations in higher-order assembly language. In: S. Brrokes , M. Main , A. Melton , and D. Schmidt , editors, Mathematical Foundations of Programming Semantics, volume 598 of Lecture Notes in Computer Science, Pittsburgh, Pennsylvania. 7th International Conference, 294311.

Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Mathematical Structures in Computer Science
  • ISSN: 0960-1295
  • EISSN: 1469-8072
  • URL: /core/journals/mathematical-structures-in-computer-science
Please enter your name
Please enter a valid email address
Who would you like to send this to? *


Full text views

Total number of HTML views: 0
Total number of PDF views: 12 *
Loading metrics...

Abstract views

Total abstract views: 228 *
Loading metrics...

* Views captured on Cambridge Core between September 2016 - 25th June 2017. This data will be updated every 24 hours.