Representing Control: a Study of the CPS Transformation
- 1 June 1992
- journal article
- research article
- Published by Cambridge University Press (CUP) in Mathematical Structures in Computer Science
- Vol. 2 (4) , 361-391
- https://doi.org/10.1017/s0960129500001535
Abstract
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.Keywords
This publication has 16 references indexed in Scilit:
- Automatic autoprojection of higher order recursive equationsScience of Computer Programming, 1991
- Automatic autoprojection of recursive equations with global variables and abstract data typesScience of Computer Programming, 1991
- Revised 4 report on the algorithmic language schemeACM SIGPLAN Lisp Pointers, 1991
- Compilation of functional languages by program transformationACM Transactions on Programming Languages and Systems, 1991
- Two-level semantics and abstract interpretationTheoretical Computer Science, 1989
- Mix: A self-applicable partial evaluator for experiments in compiler generationHigher-Order and Symbolic Computation, 1989
- Two-level semantics and code generationTheoretical Computer Science, 1988
- A syntactic theory of sequential controlTheoretical Computer Science, 1987
- Call-by-name, call-by-value and the λ-calculusTheoretical Computer Science, 1975
- Lambda calculus schemataACM SIGPLAN Notices, 1972