The essence of compiling with continuations
- 1 June 1993
- journal article
- Published by Association for Computing Machinery (ACM) in ACM SIGPLAN Notices
- Vol. 28 (6) , 237-247
- https://doi.org/10.1145/173262.155113
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 nai¨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 show that the actions of the code generator invert the nai¨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.This publication has 9 references indexed in Scilit:
- Representing Control: a Study of the CPS TransformationMathematical Structures in Computer Science, 1992
- Improving binding times without explicit CPS-conversionPublished by Association for Computing Machinery (ACM) ,1992
- Reasoning about programs in continuation-passing style.Published by Association for Computing Machinery (ACM) ,1992
- Realistic compilation by program transformation (detailed summary)Published by Association for Computing Machinery (ACM) ,1989
- ORBIT: an optimizing compiler for schemeACM SIGPLAN Notices, 1986
- Implementing RUSSELLACM SIGPLAN Notices, 1986
- The scheme 311 compiler an exercise in denotational semanticsPublished by Association for Computing Machinery (ACM) ,1984
- Call-by-name, call-by-value and the λ-calculusTheoretical Computer Science, 1975
- Lambda calculus schemataPublished by Association for Computing Machinery (ACM) ,1972