Continuation-based partial evaluation

  • Authors:
  • Julia L. Lawall;Olivier Danvy

  • Affiliations:
  • Computer Science Department, Brandeis University, Waltham, Massachusetts;Computer Science Department, Aarhus University, NY Munkegade, 8000 Aarhus C, Denmark

  • Venue:
  • LFP '94 Proceedings of the 1994 ACM conference on LISP and functional programming
  • Year:
  • 1994

Quantified Score

Hi-index 0.00

Visualization

Abstract

Binding-time improvements aim at making partial evaluation (a.k.a. program specialization) yield a better result. They have been achieved so far mostly by hand-transforming the source program. We observe that as they are better understood, these hand-transformations are progressively integrated into partial evaluators, thereby alleviating the need for source-level binding-time improvements.Control-based binding-time improvements, for example, follow this pattern: they have evolved from ad-hoc source-level rewrites to a systematic source-level transformation into continuation-passing style (CPS). Recently, Bondorf has explicitly integrated the CPS transformation into the specializer, thus partly alleviating the need for source-level CPS transformation. This CPS integration is remarkably effective but very complex and goes beyond a simple CPS transformation. We show that it can be achieved directly by using the control operators shift and reset, which provide access to the current continuation as a composable procedure.We automate, reproduce, and extend Bondorf's results, and describe how this approach scales up to hand-writing partial-evaluation compilers. The first author has used this method to bootstrap the new release of Consel's partial evaluator Schism. The control operators not only allow the partial evaluator to remain in direct style, but also can speed up partial evaluation significantly.