Abstract
A partial evaluator, given a program and a known “static” part of its input data, outputs a specialised or residual program in which computations depending only on the static data have been performed in advance.
Ideally the partial evaluator would be a “black box” able to extract nontrivial static computations whenever possible; which never fails to terminate; and which always produces residual programs of reasonable size and maximal efficiency, so all possible static computations have been done. Practically speaking, partial evaluators often fall short of this goal; they sometimes loop, sometimes pessimise, and can explode code size. A partial evaluator is analogous to a spirited horse: while impressive results can be obtained when used well, the user must know what he/she is doing. Our thesis is that this knowledge can be communicated to new users of these tools.
This paper presents a series of examples, concentrating on a quite broad and on the whole quite successful application area: using specialisation to remove interpretational overhead. It presents both positive and negative examples, to illustrate the effects of program style on the efficiency and size of the of target programs obtained by specialising an interpreter with respect to a known source program. It concludes with a checklist summarising what was learned from the examples, discussions, and problem analyses.
This research was partially supported by the Danish DART project, and the Esprit BRA Atlantique.
This is a preview of subscription content, log in via an institution.
Preview
Unable to display preview. Download preview PDF.
References
A. Bondorf and O. Danvy, ‘Automatic autoprojection of recursive equations with global variables and abstract data types,’ Science of Computer Programming, 16:151–195, 1991.
C. Consel, ‘New insights into partial evaluation: The Schism experiment,’ in H. Ganzinger (ed.), ESOP '88, 2nd European Symposium on Programming, Nancy, France, March 1988 (Lecture Notes in Computer Science, vol. 300), pp. 236–246, Berlin: Springer-Verlag, 1988.
A. De Niel, E. Bevers, and K. De Vlaminck, ‘Partial evaluation of polymorphically typed functional languages: The representation problem,’ in M. Billaud et al. (eds.), Analyse Statique en Programmation équationnelle, Fonctionnelle, et Logique, Bordeaux, France, Octobre 1991 (Bigre, vol. 74), pp. 90–97, Rennes: IRISA, 1991.
J. Gallagher: Specialization of logic programs. PEPM 93 (Partial Evaluation and Semantics-based Program Manipulation), pp. 88–98. ACM Press, 1993.
N.D. Jones, A.G. Genstrup ‘BTA Algorithms to ensure termination of offline partial evaluation,’ submitted to Second Andrei Ershov Memorial Conference, Akademgorodok, Russia, June 1996.
Neil D. Jones, C.K. Gomard, P. Sestoft, Partial Evaluation and Automatic Program Generation, Prentice Hall International Series in Computer Science, 1993.
J.W. Lloyd, J.C. Shepherdson, ‘Partial evaluation in logic programming,’ Journal of Logic Programming 11(3-4), pp. 217–242, 1991.
T. Mogensen, ‘Partially static structures in a self-applicable partial evaluator,’ in D. Bjørner, A.P. Ershov, and N.D. Jones (eds.), Partial Evaluation and Mixed Computation, pp. 325–347, Amsterdam: North-Holland, 1988.
T. Mogensen, ‘Separating binding times in language specifications,’ in Fourth International Conference on Functional Programming Languages and Computer Architecture, London, England, September 1989, pp. 14–25, Reading, MA: Addison-Wesley, 1989.
D. Sahlin, ‘The Mixtus approach to automatic partial evaluation of full Prolog,’ in S. Debray and M. Hermenegildo (eds.), Logic Programming: Proceedings of the 1990 North American Conference, Austin, Texas, October 1990, pp. 377–398, Cambridge, MA: MIT Press, 1990.
D.A. Schmidt, Denotational Semantics, Boston, MA: Allyn and Bacon, 1986.
V.F. Turchin, ‘The concept of a supercompiler,’ ACM Transactions on Programming Languages and Systems, 8(3):292–325, July 1986.
D. Weise, R. Conybeare, E. Ruf, and S. Seligman, ‘Automatic online partial evaluation,’ in J. Hughes (ed.), Functional Programming Languages and Computer Architecture, Cambridge, Massachusetts, August 1991 (Lecture Notes in Computer Science, vol. 523), pp. 165–191, Berlin: Springer-Verlag, 1991.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1996 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Jones, N.D. (1996). What not to do when writing an interpreter for specialisation. In: Danvy, O., Glück, R., Thiemann, P. (eds) Partial Evaluation. Lecture Notes in Computer Science, vol 1110. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-61580-6_11
Download citation
DOI: https://doi.org/10.1007/3-540-61580-6_11
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-61580-4
Online ISBN: 978-3-540-70589-5
eBook Packages: Springer Book Archive