Online type-directed partial evaluation for dynamically-typed languages

Eijiro Sumii, Naoki Kobayashi

Research output: Contribution to journalArticlepeer-review

5 Citations (Scopus)


This article presents an alternative method of type-directed partial evaluation, which is simpler and more efficient than previous methods. Unlike previous methods, it is straightforwardly applicable to functional languages with various powerful type systems. As an extreme instance, this article mainly deals with a dynamically-typed functional language like Scheme. The key idea is to extend primitive value destructors such as function application and pair destruction (car and cdr), so that they generate residual code when their operands are dynamic. It unnecessitates an operation in type-directed partial evaluation called reflection, which was the major cause of complication and inefficiency in previous methods. We formalize our method as an extension of two-level λ-calculus, and prove it correct. Furthermore, we show that our type-directed partial evaluator can be derived from a simple online syntax-directed partial evaluator with higher-order abstract syntax, by the same transformation as an offline program-generator-generator (cogen) is derived from an offline syntax-directed partial evaluator. This clarifies why type-directed partial evaluation is faster than ordinary syntax-directed partial evaluation, and implies that we can obtain more powerful par-tial evaluators by replacing the underlying syntax-directed partial evaluator with more sophisticated ones.

Original languageEnglish
Pages (from-to)38-62
Number of pages25
JournalComputer Software
Issue number3
Publication statusPublished - 2000
Externally publishedYes

ASJC Scopus subject areas

  • Software


Dive into the research topics of 'Online type-directed partial evaluation for dynamically-typed languages'. Together they form a unique fingerprint.

Cite this