|
ABSTRACT
The continuation-passing style (CPS) transformation is powerful but complex. Our thesis is that this transformation is in fact compound, and we set out to stage it. We factor the CPS transformation into several steps, separating aspects in each step: (1) Intermediate values are named; (2) Continuations are introduced; (3) Sequencing order is decided and administrative reductions are performed.
Step 1 determines the evaluation order (e.g., call-by-name or call-by-value). Step 2 isolates the introduction of continuations and is expressed with local, structure-preserving rewrite rules — a novel aspect standing in sharp contrast with the usual CPS transformations. Step 3 determines the ordering of continuations (e.g., left-to-right or right-to-left evaluation) and leads to the familiar-looking continuation-passing terms.
Step 2 is completely reversible and Steps 1 and 3 form Galois connections. Together they lead to the direct style (DS) transformation of our earlier work (including first-class continuations): (1) Intermediate continuations are named and sequencing order is abstracted; (2) Second-class continuations are eliminated; (3) Administrative reductions are performed.
A subset of these transformations can leverage program manipulation systems: CPS-based compilers can modify sequencing to improve e.g., register allocation; static program analyzers can yield more precise results; and overspecified CPS programs can be rescheduled. Separating aspects of the CPS transformation also enables a new programming style, with applications to nondeterministic programming. As a byproduct, our work also suggests a new continuation semantics for unspecified sequencing orders in programming languages (e.g., Scheme).
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
|
 |
2
|
|
| |
3
|
|
 |
4
|
H. Abelson , R. K. Dybvig , C. T. Haynes , G. J. Rozas , N. I. Adams, IV , D. P. Friedman , E. Kohlbecker , G. L. Steele, Jr. , D. H. Bartley , R. Halstead , D. Oxley , G. J. Sussman , G. Brooks , C. Hanson , K. M. Pitman , M. Wand , William Clinger , Jonathan Rees, Revised report on the algorithmic language scheme, ACM SIGPLAN Lisp Pointers, v.IV n.3, p.1-55, July, 1991
[doi> 10.1145/382130.382133]
|
| |
5
|
Charles Consel. Report on Schism'92. Oregon Graduate Institute, Beaverton, Oregon, October 1992. Research Report.
|
| |
6
|
|
| |
7
|
Olivier Danvy. Three steps for the CPS transformation. Technical Report CIS-92-2, Kansas State University, Manhattan, Kansas, December 1991.
|
| |
8
|
|
| |
9
|
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4), 1992. To appear.
|
| |
10
|
Olivier Danvy and John Hatcliff. Thunks (continued). In Proceedings of the Workshop on Static Anal. ysis WSA '92, volume 81-82 of Bigre Journal, pages 3- 11, Bordeaux, France, September 1992. IRISA, Rennes, France.
|
 |
11
|
|
| |
12
|
|
| |
13
|
|
 |
14
|
|
| |
15
|
|
| |
16
|
|
 |
17
|
|
| |
18
|
|
| |
19
|
William L. Harrison III. The interprocedural analysis and automatic parallelization of Scheme programs. LISP and Symbolic Computation, 2(3/4):179-396, October 1989.
|
 |
20
|
|
| |
21
|
Proceedings ol the 199f2 A CM Conference on Lisp and Functional Programming, San Francisco, California, June 1992.
|
| |
22
|
Karoline Malmkjaer. On static properties of specialized programs. In Michel Billaud et al., editor, Analyse Statique en Programmation Equationnelle, Fonctionnelie et Logique, volume 74 of Bigre Journal, pages 234- 241, Bordeaux, France, October 1991. IRISA, Rennes, France.
|
| |
23
|
Karoline Malmkjmr. Predicting properties of residual programs. In Charles Consel, editor, A CM SIGPLAN Workshop on Partial Evaluation and Semantics.Based Program Manipulation, Research Report 909, Department of Computer Science, Yale University, pages 8-13, San Francisco, California, June 1992.
|
| |
24
|
|
| |
25
|
|
| |
26
|
|
| |
27
|
Chetan R. Murthy. An evaluation semantics for classical proofs. In Proceedings of the Sixth Symposium on Logic in Computer Science, pages 96-107, Amsterdam, The Netherlands, July 1991. IEEE.
|
| |
28
|
Flemming Nielson. A denotational framework for data flow analysis. Acta informatica, 18:265--287, 1982.
|
| |
29
|
Gordon D. Plotkin. Call-by-name, call-by-value and the A-calculus. Theoretical Computer Science, 1:125-159, 1975.
|
 |
30
|
|
 |
31
|
|
| |
32
|
|
| |
33
|
|
| |
34
|
|
| |
35
|
|
| |
36
|
Christopher Strachey and Christopher P. Wadsworth. Continuations: A mathematical semantics for handling full jumps. Technical Monograph PRG-11, Oxford University Computing L~boratory, Programming Research Group, Oxford, England, 1974.
|
 |
37
|
|
| |
38
|
|
|