The Treatment of Polymorphism and Modules in a Partial Evaluator
Doktorsavhandling, 2001

In this thesis we study aspects of specialisation by partial evaluation and compiler generation. After significant research during the last two decades, there are now powerful specialisers for several programming languages, such as LISP, Scheme, ML, and C. But some features of programming languages are still not handled by specialisers. We consider two such features: polymorphic types and modules. In our formalism of the binding-time analyser, we provide a solution to how to treat coercions in the context of polymorphism: coercions are used to make values more dynamic. Furthermore, since the semantics of the partial evaluator affect the binding-time analyser, we have formalised both the binding-time rules and the specialiser. We also discuss practical issues arising from our integration of a polymorphic binding-time analyser with a specialiser: the treatment of fix-points, program points, and bounded static variation. Where modules are concerned, we consider specialising a program consisting of several modules into a specialised version that also consists of several modules. This work relies heavily on a polymorphic binding-time analyser and a compiler generator. The polymorphic binding-time analyser works independently on each module. For each annotated module, we use a compiler generator to create a generating extension. Then we build generating extensions for complete programs, in much the same way as the original modules were put together into complete programs. The result of running all generating extensions is a collection of residual modules, which have a structure derived from the original program. But modules cause another problem. Previous specialisers produced a program consisting of one module, derived from a source program of one module. It is a weakness that the program being specialised imposes a limitation on the structure of the program generated, in this case, the number of modules. In this thesis we remove the restriction. Since we can obtain many modules by specialising one module, we remove an ``inherited limit'' on the total number of modules. In this work, we need new types of annotation to control the specialisation. We have formalised a binding-time analyser for finding such annotations. We have also given the semantics of the partial evaluator.


partial evaluation

separate compilation

compiler generator

functional programming

binding-time analyser

polymorphic types


Rogardt Heldal

Institutionen för datavetenskap


Data- och informationsvetenskap



Doktorsavhandlingar vid Chalmers tekniska högskola. Ny serie: 1695

Mer information