A type-directed, on-line, partial evaluator for a polymorphic language

Tim Sheard
1997 SIGPLAN notices  
Recently, Olivier Danvy introduced a new, simple method for implementing powerful partial evaluators, namely typedirected partial evaluation 9 . He introduced a partial evaluator for the simply-typed lambda calculus x2. This paper explores the possibility of using the same techniques over a lambda calculus with a richer type system. We generalize and extend Danvy's work in four ways: 1. Our system handles a much richer language than that presented by Danvy, including all of the features
more » ... al programmers have come to expect, such as polymorphism x5, inductive datatypes x10, and recursion x9. 2. Our system includes a new systematic treatment o f primitive operators x7 and the propagation of residualized code x7.1. This question has either been ignored or treated in an ad-hoc manner in previous work. 3. Our system handles non-closed terms x6. This makes type-directed partial evaluation much more practically useful, and can easily be extended to work in languages with parameterized module systems. 4. Our system makes the whole process more e cient, by using a lazy, on-demand implementation x8. The laziness of our implementation also causes the code produced to be more abstract and compact. Using this lazy implementation we h a ve observed speedup ratios in the range 2-10, and code compactness improvements of more than 10 in some cases. All these extensions are made possible by a k ey technical innovation, namely, embedding types in values.
doi:10.1145/258994.258999 fatcat:7bctzlnb7jas7h6mcmcy7ujweq