What not to do when writing an interpreter for specialisation

  • Neil D. Jones
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1110)


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.


Residual Program Logic Programming Operational Semantic Partial Evaluation Procedure Call 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    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.Google Scholar
  2. 2.
    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.Google Scholar
  3. 3.
    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.Google Scholar
  4. 4.
    J. Gallagher: Specialization of logic programs. PEPM 93 (Partial Evaluation and Semantics-based Program Manipulation), pp. 88–98. ACM Press, 1993.Google Scholar
  5. 5.
    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.Google Scholar
  6. 6.
    Neil D. Jones, C.K. Gomard, P. Sestoft, Partial Evaluation and Automatic Program Generation, Prentice Hall International Series in Computer Science, 1993.Google Scholar
  7. 7.
    J.W. Lloyd, J.C. Shepherdson, ‘Partial evaluation in logic programming,’ Journal of Logic Programming 11(3-4), pp. 217–242, 1991.Google Scholar
  8. 8.
    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.Google Scholar
  9. 9.
    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.Google Scholar
  10. 10.
    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.Google Scholar
  11. 11.
    D.A. Schmidt, Denotational Semantics, Boston, MA: Allyn and Bacon, 1986.Google Scholar
  12. 12.
    V.F. Turchin, ‘The concept of a supercompiler,’ ACM Transactions on Programming Languages and Systems, 8(3):292–325, July 1986.Google Scholar
  13. 13.
    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.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1996

Authors and Affiliations

  • Neil D. Jones
    • 1
  1. 1.DIKUUniversity of CopenhagenDenmark

Personalised recommendations