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

  • Authors:
  • Tim Sheard

  • Affiliations:
  • Oregon Graduate Institute of Science & Technology, P.O. Box 91000, Portland, OR

  • Venue:
  • PEPM '97 Proceedings of the 1997 ACM SIGPLAN symposium on Partial evaluation and semantics-based program manipulation
  • Year:
  • 1997

Quantified Score

Hi-index 0.00

Visualization

Abstract

Recently, Olivier Danvy introduced a new, simple method for implementing powerful partial evaluators, namely type-directed partial evaluation[9]. He introduced a partial evaluator for the simply-typed lambda calculus (§2). 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 functional programmers have come to expect, such as polymorphism (§5), inductive datatypes (§10), and recursion (§9).2. Our system includes a new systematic treatment of primitive operators (§7) and the propagation of residualized code (§7.1). This question has either been ignored or treated in an ad-hoc manner in previous work.3. Our system handles non-closed terms (§6). 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 efficient, by using a lazy, on-demand implementation (§8). The laziness of our implementation also causes the code produced to be more abstract and compact. Using this lazy implementation we have 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 key technical innovation, namely, embedding types in values.