The Second Futamura Projection for Type-Directed Partial Evaluation

Bernd Grobauer, Zhe Yang
1999 BRICS Report Series  
A generating extension of a program specializes it with respect to<br />some specified part of the input. A generating extension of a program<br />can be formed trivially by applying a partial evaluator to the program;<br />the second Futamura projection describes the automatic generation<br />of non-trivial generating extensions by applying a partial evaluator to<br />itself with respect to the programs.<br />We derive an ML implementation of the second Futamura projection<br /> for
more » ... ed Partial Evaluation (TDPE). Due to the differences<br /> between 'traditional', syntax-directed partial evaluation and<br />TDPE, this derivation involves several conceptual and technical steps.<br />These include a suitable formulation of the second Futamura projection<br /> and techniques for making TDPE amenable to self-application. In<br />the context of the second Futamura projection, we also compare and<br />relate TDPE with conventional offline partial evaluation.<br />We demonstrate our technique with several examples, including<br />compiler generation for Tiny, a prototypical imperative language.
doi:10.7146/brics.v6i40.20109 fatcat:oeu633pblbbuzezfrki6e2stmy