Formalizing Implementation Strategies for First-Class Continuations

We present the first formalization of implementation strategies for first-class continuations. The formalization hinges on abstract machines for continuation-passing style (CPS) programs with a special treatment for the current continuation, accounting for the essence of first-class continuations. These abstract machines are proven equivalent to a standard, substitution-based abstract machine. The proof techniques work uniformly for various representations of continuations. As a byproduct, we also present a formal proof of the two folklore theorems that one continuation identifier is enough for second-class continuations and that second-class continuations are stackable. A large body of work exists on implementing continuations, but it is predominantly empirical and implementation-oriented. In contrast, our formalization abstracts the essence of first-class continuations and provides a uniform setting for specifying and formalizing their representation.

[1]  Robert Harper,et al.  Typing first-class continuations in ML , 1991, POPL '91.

[2]  Olivier Danvy,et al.  Representing Control: a Study of the CPS Transformation , 1992, Mathematical Structures in Computer Science.

[3]  Daniel P. Friedman,et al.  Embedding continuations in procedural objects , 1987, TOPL.

[4]  Maxim Sviridenko,et al.  An Approximation Algorithm for Hypergraph Max k-Cut with Given Sizes of Parts , 1999, ESA.

[5]  Gordon D. Plotkin,et al.  Call-by-Name, Call-by-Value and the lambda-Calculus , 1975, Theor. Comput. Sci..

[6]  Olivier Danvy Memory allocation and higher-order functions , 1987, PLDI 1987.

[7]  P. J. Landin The Mechanical Evaluation of Expressions , 1964, Comput. J..

[8]  Olivier Danvy,et al.  Back to direct style II: first-class continuations , 1992, LFP '92.

[9]  Christopher Strachey,et al.  Continuations: A Mathematical Semantics for Handling Full Jumps , 2000, High. Order Symb. Comput..

[10]  Torben Amtoft,et al.  Partial Evaluation for Constraint-Based Program Analyses , 1999 .

[11]  Paul Hudak,et al.  ORBIT: an optimizing compiler for scheme , 1986, SIGPLAN '86.

[12]  Olivier Danvy Formalizing Implementation Strategies for First-Class Continuations , 1999 .

[13]  Matthias Felleisen,et al.  The calculi of lambda-nu-cs conversion: a syntactic theory of control and state in imperative higher-order programming languages , 1987 .

[14]  Drew McDermott,et al.  An efficient environment allocation scheme in an interpreter for a lexically-scoped LISP , 1980, LISP Conference.

[15]  Peter Bro Miltersen,et al.  Super-Polynomial Versus Half-Exponential Circuit Size in the Exponential Hierarchy , 1999, COCOON.

[16]  Olivier Danvy,et al.  On proving syntactic properties of CPS programs , 1999, Electron. Notes Theor. Comput. Sci..

[17]  Srinivasan Venkatesh,et al.  Improved bounds for dictionary look-up with one error , 2000, Inf. Process. Lett..

[18]  Robert Hieb,et al.  Representing control in the presence of first-class continuations , 1990, PLDI '90.

[19]  Olivier Danvy,et al.  The Occurrence of Continuation Parameters in CPS Terms , 1995 .

[20]  Jr. Guy L. Steele,et al.  Rabbit: A Compiler for Scheme , 1978 .

[21]  Daniel M. Berry,et al.  Block Structure: Retention or Deletion? (Extended Abstract) , 1971, STOC 1971.

[22]  Daniel M. Berry Block structure (Extended Abstract): Retention or deletion? , 1971, STOC '71.

[23]  Jonathan Rees,et al.  A tractable Scheme implementation , 1994, LISP Symb. Comput..

[24]  Andrew W. Appel,et al.  Standard ML of New Jersey , 1991, PLILP.

[25]  William D. Clinger,et al.  Implementation Strategies for First-Class Continuations , 1999, High. Order Symb. Comput..

[26]  David H. Bartley,et al.  The implementation of PC Scheme , 1986, LFP '86.

[27]  Amr Sabry,et al.  The essence of compiling with continuations , 1993, PLDI '93.