|
ABSTRACT
In order to simplify the compilation process, many compilers for higher-order languages use the continuation-passing style (CPS) transformation in a first phase to generate an intermediate representation of the source program. The salient aspect of this intermediate form is that all procedures take an argument that represents the rest of the computation (the "continuation"). Since the naïve CPS transformation considerably increases the size of programs, CPS compilers perform reductions to produce a more compact intermediate representation. Although often implemented as a part of the CPS transformation, this step is conceptually a second phase. Finally, code generators for typical CPS compilers treat continuations specially in order to optimize the interpretation of continuation parameters.A thorough analysis of the abstract machine for CPS terms shows that the actions of the code generator invert the naïve CPS translation step. Put differently, the combined effect of the three phases is equivalent to a source-to-source transformation that simulates the compaction phase. Thus, fully developed CPS compilers do not need to employ the CPS transformation but can achieve the same results with a simple source-level transformation.
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
|
Andrew W. Appel and David B. MacQueen. Standard ML of New Jersey. In J. Maluszyński and M. Wirsing, editors, Proceedings of the 3rd Int. Symposium on Programming Language Implementation and Logic Programming, PLILP91, Passau, Germany, Lecture Notes in Computer Science, pages 1--13. Springer-Verlag, August 1991.
|
| |
4
|
Andrew W. Appel and David B. MacQueen. Standard ML of New Jersey. Technical Report TR-329-91, Princeton University, Computer Science Department, June 1991.
|
 |
5
|
|
| |
6
|
M. Felleisen and D. P. Friedman. Control operators, the SECD-machine, and the λ-calculus, pages 193--217. North-Holland, 1986.
|
 |
7
|
|
| |
8
|
Matthias Felleisen, Daniel P. Friedman, Eugene Kohlbecker, and Bruce Duba. Reasoning with continuations. In Proc. of 1st Ann. IEEE Symp. on Logic in Computer Science, LICS'86, Cambridge, MA, USA, 16--18 June 1986, pages 131--141. IEEE Computer Society Press, Washington, DC, 1986.
|
| |
9
|
|
 |
10
|
|
| |
11
|
|
 |
12
|
|
 |
13
|
David Kranz , Norman Adams , Richard Kelsey , Jonathan Rees , Paul Hudak , James Philbin, ORBIT: an optimizing compiler for scheme, ACM SIGPLAN Notices, v.21 n.7, p.219-233, July 1986
|
| |
14
|
Xavier Leroy. A syntactic theory of type generativity and sharing. Journal of Functional Programming, 6(5):667--698, September 1996.
|
| |
15
|
G. Plotkin. Call-by-name, call-by-value, and the λ-calculus. Theoretical Computer Science, 1(2):125--159, 1975.
|
| |
16
|
John Reppy. Local CPS conversion in a direct-style compiler. In Proceedings of the Third ACM SIGPLAN Workshop on Continuations (CW'01), pages 13--22, January 2001.
|
 |
17
|
|
| |
18
|
|
 |
19
|
|
| |
20
|
|
 |
21
|
D. Tarditi , G. Morrisett , P. Cheng , C. Stone , R. Harper , P. Lee, TIL: a type-directed optimizing compiler for ML, Proceedings of the ACM SIGPLAN 1996 conference on Programming language design and implementation, p.181-192, May 21-24, 1996, Philadelphia, Pennsylvania, United States
|
| |
22
|
Alfred V. Aho , Ravi Sethi , Jeffrey D. Ullman, Compilers: principles, techniques, and tools, Addison-Wesley Longman Publishing Co., Inc., Boston, MA, 1986
|
| |
23
|
|
| |
24
|
BARENDREGT, H. The Lambda Calculus: Its Syntax and Semantics, revised ed. Studies in Logic and the Foundations of Mathematics 103. North-Holland, 1984.
|
 |
25
|
|
 |
26
|
|
 |
27
|
|
| |
28
|
|
| |
29
|
DANVY, O. Three steps for the CPS transformation. Tech. Rep. CIS-92-2, Kansas State University, 1992.
|
| |
30
|
DANVY, O., AND FILINSKI, A. Representing control: A study of the CPS transformation. Mathematical Structures in Computer Science, 4 (1992), 361--391.
|
| |
31
|
FELLEISEN, M., AND FRIEDMAN, D. Control operators, the SECD-machine, and the λ-calculus. In Formal Description of Programming Concepts III (Amsterdam, 1986), M. Wirsing, Ed., Elsevier Science Publishers B.V. (North-Holland), pp. 193--217.
|
| |
32
|
FESSENDEN, C., CLINGER, W., FRIEDMAN, D. P., AND HAYNES, C. T. Scheme 311 version 4 reference manual. Computer Science Technical Report 137, Indiana University, Bloomington, Indiana, Feb. 1983.
|
 |
33
|
|
 |
34
|
|
 |
35
|
David Kranz , Norman Adams , Richard Kelsey , Jonathan Rees , Paul Hudak , James Philbin, ORBIT: an optimizing compiler for scheme, ACM SIGPLAN Notices, v.21 n.7, p.219-233, July 1986
|
| |
36
|
LEROY, X. The Zinc experiment: An economical implementation of the ML language. Tech. Rep. 117, INRIA, 1990.
|
| |
37
|
PLOTKIN, G. Call-by-name, call-by-value, and the λ-calculus. Theoretical Computer Science 1 (1975), 125--159.
|
 |
38
|
|
| |
39
|
|
| |
40
|
STEELE, G. L. RABBIT: A compiler for Scheme. MIT AI Memo 474, Massachusetts Institute of Technology, Cambridge, Mass., May 1978.
|
| |
41
|
|
| |
42
|
WEISE, D. Advanced compiling techniques. Course Notes at Stanford University, 1990.
|
|