Offline partial evaluation for shift and reset

This paper presents an offline partial evaluator for the λ-calculus with the delimited continuation constructs shift and reset. Based on Danvy and Filinski's type system for shift and reset, we first present a type system that specifies well-annotated terms. We then show a specializer that receives an annotated term and produces the output in continuation-passing style (CPS). The correctness of our partial evaluator is established using the technique of logical relations. Thanks to the explicit reference to the type of continuations, we can establish the correctness using the standard proof technique of structural induction, despite the fact that the specializer itself is written in CPS. The paper also shows an efficient constraint-based binding-time analysis as well as how to extend the present work to richer language constructs, such as recursion and conditionals.

[1]  Erik Ruf Topics in online partial evaluation , 1993 .

[2]  Olivier Danvy,et al.  Abstracting control , 1990, LISP and Functional Programming.

[3]  Olivier Danvy,et al.  A first-order one-pass CPS transformation , 2003, Theor. Comput. Sci..

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

[5]  Peter Thiemann Cogen in six lines , 1996, ICFP '96.

[6]  Anders Bondorf,et al.  Improving CPS-Based Partial Evaluation: Writing Cogen by Hand , 1994, PEPM.

[7]  Satoshi Matsuoka,et al.  Duplication and partial evaluation , 1996 .

[8]  Andrew M. Pitts,et al.  A new approach to abstract syntax involving binders , 1999, Proceedings. 14th Symposium on Logic in Computer Science (Cat. No. PR00158).

[9]  Olivier Danvy,et al.  Continuation-based partial evaluation , 1994, LFP '94.

[10]  Yoshihiko Futamura,et al.  Partial Evaluation of Computation Process--An Approach to a Compiler-Compiler , 1999, High. Order Symb. Comput..

[11]  L LawallJulia,et al.  Back to direct style II , 1992 .

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

[13]  Andrzej Filinski,et al.  Representing monads , 1994, POPL '94.

[14]  Olivier Danvy,et al.  Back to Direct Style , 1992, Sci. Comput. Program..

[15]  Matthias Felleisen,et al.  The theory and practice of first-class prompts , 1988, POPL '88.

[16]  Anders Bondorf,et al.  Automatic Autoprojection of Recursive Equations with Global Variables and Abstract Data Types , 1991, Sci. Comput. Program..

[17]  David Grove,et al.  Identifying Profitable Specialization in Object-Oriented Languages , 1994, PEPM.

[18]  Fritz Henglein,et al.  Efficient Type Inference for Higher-Order Binding-Time Analysis , 1991, FPCA.

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

[20]  Peter Thiemann,et al.  Combinators for program generation , 1999, Journal of Functional Programming.

[21]  Amr Sabry,et al.  Reasoning about programs in continuation-passing style , 1992, LFP '92.

[22]  Peter Sestoft,et al.  Partial evaluation and automatic program generation , 1993, Prentice Hall international series in computer science.

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

[24]  Mitchell Wand Specifying the Correctness of Binding-Time Analysis , 1993, J. Funct. Program..

[25]  Satoshi Matsuoka,et al.  Compiling away the meta-level in object-oriented concurrent reflective languages using partial evaluation , 1995, OOPSLA.

[26]  Michael Sperber,et al.  Final shift for call/cc:: direct implementation of shift and reset , 2002, ICFP '02.

[27]  Olivier Danvy A New One-Pass Transformation into Monadic Normal Form , 2003, CC.

[28]  R. Kent Dybvig,et al.  Revised5 Report on the Algorithmic Language Scheme , 1986, SIGP.