Termination analysis for offline partial evaluation of a higher order functional language

  • Peter Holst Andersen
  • Carsten Kehler Holst
Contributed Papers
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1145)


One of the remaining problems on the path towards fully automatic partial evaluation is ensuring termination of the specialization phase. In [10] we gave a termination analysis which could be applied to partial evaluation of first-order strict languages, using a new result about inductive arguments (loosely: if whenever something grows, something gets smaller then the program will only enter finitely many different states). In this paper we extend this work to cover higher-order functional languages. We take an operational approach to the problem and consider the closure representation of higher-order functions to perform a combined data- and control-dependency analysis. The result of this analysis is then used, as in the first-order case, to decide which arguments need to be dynamic to guarantee termination of partial evaluation of the analysed program. The new methods have been tested on a variety of programs, and will be incorporated in a future release of the Similix partial evaluator for Scheme.


partial evaluation termination abstract interpretation size analysis 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    The Similix system, version 5.1. 1995.Google Scholar
  2. 2.
    Lars Ole Andersen. Binding-time analysis and the taming of C pointers. In David Schmidt, editor, Proc. of ACM Symposium on Partial Evaluation and Semantics-Based Program Manipulation, PEPM'93, pages 47–58, 1993.Google Scholar
  3. 3.
    Lars Ole Andersen. Program Analysis and Specialization for the C Programming Language. PhD thesis, DIKU, University of Copenhagen, May 1994. (DIKU report 94/19).Google Scholar
  4. 4.
    Peter Holst Andersen and Carsten Kehler Holst. Termination Analysis for Offline Partial Evaluation of a Higher Order Functional Language. Technical Report, DIKU, University of Copenhagen, Denmark, 1996. To appear.Google Scholar
  5. 5.
    Anders Bondorf and Jesper JØrgensen. Efficient analyses for realistic off-line partial evaluation: extended version. Technical Report 93/4, DIKU, University of Copenhagen, Denmark, 1993.Google Scholar
  6. 6.
    Charles Consel. A tour of Schism: a partial evaluation system for higher-order applicative languages. In David Schmidt, editor, ACM SIGPLAN Symposium on Partial Evaluation and Semantics Based Program Manipulation, pages 145–154, June 1993.Google Scholar
  7. 7.
    Charles Consel and Olivier Danvy. Partial evaluation of pattern matching in strings. Information Processing Letters, 30:79–86, January 1989.CrossRefGoogle Scholar
  8. 8.
    B. A. Davey and H. A. Priestley. Introduction to Lattices and Order. Cambridge Mathematical Textbooks, Cambridge University Press, 1990.Google Scholar
  9. 9.
    Arne J. Glenstrup and Neil D. Jones. BTA algorithms to ensure termination of off-line partial evaluation. In Andrei Ershov Second International Conference “Perspectives of System Informatics∝, Lecture Notes in Computer Science, 1996. Upcoming.Google Scholar
  10. 10.
    Carsten Kehler Holst. Finiteness analysis. In John Hughes, editor, Functional Programming Languages and Computer Architectures, pages 473–495, ACM, Springer-Verlag, Cambridge, Massachusetts, USA, August 1991.Google Scholar
  11. 11.
    Neil D. Jones, Carsten Gomaxd, and Peter Sestoft. Partial Evaluation and Automatic Program Generation. C.A.R. Hoare, Series Editor, Prentice Hall International, International Series in Computer Science, June 1993. ISBN number 0-13-020249-5 (pbk).Google Scholar
  12. 12.
    Neil D. Jones and Steven S. Muchnick. Flow analysis and optimization of Lisp-like structures. In Steven S. Muchnick and Neil D. Jones, editors, Program Flow Analysis: Theory and Applications, chapter 4, pages 102–131, Prentice-Hall, 1981.Google Scholar
  13. 13.
    H.G. Rice. Classes of recursively enumerable sets and their decision problems. Transaction of the AMS, 89:25–59, 1953.Google Scholar
  14. 14.
    Peter Sestoft. Replacing Function Parameters by Global Variables. Master's thesis, DIKU, University of Copenhagen, Denmark, October 1988. 107 pages.Google Scholar
  15. 15.
    David N. Turner, Philip Wadler, and Christian Mossin. Once upon a type. In 7'th International Conference on Functional Programming and Computer Architecture, pages 1–11, ACM Press, La Jolla, California, June 1995.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1996

Authors and Affiliations

  • Peter Holst Andersen
    • 1
  • Carsten Kehler Holst
    • 2
  1. 1.Department of Computer ScienceUniversity of CopenhagenDenmark
  2. 2.Prolog Development CenterDenmark

Personalised recommendations