Home
Scholarly Works
The essence of compiling with continuations
Conference

The essence of compiling with continuations

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.

Authors

Flanagan C; Sabry A; Duba BF; Felleisen M

Volume

28

Pagination

pp. 237-247

Publisher

Association for Computing Machinery (ACM)

Publication Date

December 1, 1993

DOI

10.1145/155090.155113

Name of conference

Proceedings of the ACM SIGPLAN 1993 conference on Programming language design and implementation

Conference proceedings

ACM SIGPLAN Notices

Issue

6

ISSN

0362-1340
View published work (Non-McMaster Users)

Contact the Experts team