Advertisement

New Generation Computing

, 9:305 | Cite as

The derivation of an algorithm for program specialisation

  • John Gallagher
  • Maurice Bruynooghe
Special Issue

Abstract

In this paper we develop an algorithm, based on abstract interpretation, for source specialisation of logic programs. This approach is more general than partial evaluation, another technique for source specialisation, and can perform some source specialisations that cannot be done by partial evaluation; examples are specialisations that use information from infinite computations. Our algorithm for program specialisation usesminimal function graphs as a basis. Previous work on minimal function graphs is extended by describing a scheme for constructing a minimal function graph for a simple functional language, and then using that to define a minimal function graph constructor for Prolog. We show how to compute a more precise approximation to the minimal function graph than was obtained in previous work. The efficient computation of minimal function graphs is also discussed. An abstract interpretation based on unfolding paths is then developed for Prolog program specialisation.

Keywords

Program Specialisation Partial Evaluation Obstruct Interpretation 

References

  1. 1).
    Abramsky, S. and Hankin, C., eds.:Abstract Interpretation of Declarative Languages, Ellis Horwood, 1987.Google Scholar
  2. 2).
    Benkerimi, K. and Lloyd, J. W., “A Procedure for Partial Evaluation of Logic Programs,”Proceedings of the North American Conference on Logic Programming, November 1990, Austin, Texas (S. Debray and M. Hermenegildo, eds.), MIT Press, 1990.Google Scholar
  3. 3).
    Bruynooghe, M., “A Practical Framework for the Abstract Interpretation of Logic Programs,” to appear inJournal of Logic Programming.Google Scholar
  4. 4).
    Codish, M., Gallagher, J. and Shapiro, E., “Using Safe Approximations of Fixed Points for Analysis of Logic Programs,” inMeta-Programming in Logic Programming (H. Abramson and M. Rogers, eds.), MIT Press, 1989.Google Scholar
  5. 5).
    Gallagher, J. and Codish, M. and Shapiro, E., “Specialisation of Prolog and FCP Programs Using Abstract Interpretation,”New Generation Computing, 6, pp. 159–186, 1988.MATHCrossRefGoogle Scholar
  6. 6).
    Gallagher, J. and Bruynooghe, M., “Some Low-Level Source Transformations for Logic Programs,”Proceedings of Meta 90 Workshop on Meta Programming in Logic, Leuven, Belgium, April 1990.Google Scholar
  7. 7).
    Jones, N. D. and Søndergaard, H., “A Semantics-Based Framework for the Abstract Interpretation of Prolog,”Interpretation of Declarative Language Abstruct (S. Abramsky and C. Hankin, eds.), Ellis Horwood, 1987.Google Scholar
  8. 8).
    Jones, N. D. and Mycroft, A., “Dataflow Analysis of Applicative Programs Using Minimal Function Graphs,”Proceedings of Principles of Programming Languages, 1986.Google Scholar
  9. 9).
    Komorowski, H. J., “Partial Evaluation as a Means for Inferencing Data Structures in an Applicative Language: A Theory and Implementation in the Case of Prolog,” in9th ACM Symposium on Principles of Programming Languages, Albuquerque, New Mexico, pp. 255–267, 1982.Google Scholar
  10. 10).
    Lloyd, J. W.,Foundations of Logic Programming, 2nd Edition, Springer-Verlag, 1987.Google Scholar
  11. 11).
    Lloyd, J. W. and Shepherdson, J. C., “Partial Evaluation in Logic Programming,”Technical Report, TR-87-09, Department of Computer Science, University of Bristol, 1987 (revised 1989), to appear inJournal of Logic Programming.Google Scholar
  12. 12).
    Marriott, K. and Søndergaard, H., “Semantics-Based Dataflow Analysis of Logic Programs,” inInformation Processing 89 (G. Ritter, ed.), North-Holland, 1989.Google Scholar
  13. 13).
    Mellish, C. S., “Abstract Interpretation of Prolog Programs,”Proc. 3rd ICLP, LNCS 225, Springer-Verlag, 1986; also Chapter 8 in 1).Google Scholar
  14. 14).
    Plotkin, G., “A Note on Inductive Generalisation,” inMachine Intelligence, Vol. 5 (B. Meltzer and D. Michie, eds.), Edinburgh University Press, 1974.Google Scholar
  15. 15).
    Reynolds, J. C., “Transformational Systems and the Algebraic Structure of Atomic Formulas,” inMachine Intelligence, Vol. 5 (B. Meltzer and D. Michie, eds.), Edinburgh University Press, 1974.Google Scholar
  16. 16).
    Safra, S., “partial Evaluation of Concurrent Prolog and Its Implications,”Masters thesis, Technical Report, CS86-24, Dept. of Computer Science, Weizmann Institute, 1986.Google Scholar
  17. 17).
    Sestoft, P., “A Bibliography on Partial Evaluation and Mixed Computation,” inProceedings of Workshop on Partial Evaluation and Mixed Computation, Denmark, Oct. 1987.Google Scholar
  18. 18).
    Tamaki, H. and Sato, T., “OLD Resolution with Tabulation,”Proc. 3rd ICLP, LNCS 225, Springer-Verlag, 1986.Google Scholar
  19. 19).
    Winsborough, W., “A Minimal Function Graph Semantics for Logic Programs,”Technical Report, 711, Computer Sciences Dept., University of Wisconsin-Madison, Aug. 1987.Google Scholar
  20. 20).
    Winsborough, W., “Path-Dependent Reachability Analysis for Multiple Specialization,Proceedings of the North American Conference on Logic Programming, Cleveland, MIT Press, Oct. 1989.Google Scholar

Copyright information

© Ohmsha, Ltd. and Springer 1991

Authors and Affiliations

  • John Gallagher
    • 1
  • Maurice Bruynooghe
    • 2
  1. 1.Department of Computer ScienceUniversity of BristolBristolU.K.
  2. 2.Department of Computer ScienceKatholieke Universiteit LeuvenLeuvenBelgium

Personalised recommendations