Advertisement

Efficiently generating efficient generating extensions in prolog

  • Jesper Jørgensen
  • Michael Leuschel
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1110)

Abstract

The so called “cogen approach” to program specialisation, writing a compiler generator instead of a specialiser, has been used with considerable success in partial evaluation of both functional and imperative languages.

This paper demonstrates that this approach is also applicable to partial evaluation of logic programming languages, also called partial deduction. Self-application has not been as much in focus in partial deduction as in partial evaluation of functional and imperative languages, and the attempts to self-apply partial deduction systems have, of yet, not been altogether that successful. So, especially for partial deduction, the cogen approach could prove to have a considerable importance when it comes to practical applications.

It is demonstrated that using the cogen approach one gets very efficient compiler generators which generate very efficient generating extensions which in turn yield (for some examples at least) very good and non-trivial specialisation.

Keywords

Logic Program Logic Programming Partial Evaluation Generate Extension Predicate Symbol 
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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    L. O. Andersen. Program Analysis and Specialization for the C Programming Language. PhD thesis, DIKU, University of Copenhagen, May 1994. (DIKU report 94/19).Google Scholar
  2. 2.
    L. Beckman, A. Haraldson, ö. Oskarsson, and E. Sandewall. A partial evaluator and its use as a programming tool. Artificial Intelligence, 7:319–357, 1976.Google Scholar
  3. 3.
    K. Benkerimi and P. M. Hill. Supporting transformations for the partial evaluation of logic programs. Journal of Logic and Computation, 3(5):469–486, October 1993.Google Scholar
  4. 4.
    K. Benkerimi and J. W. Lloyd. A partial evaluation procedure for logic programs. In S. Debray and M. Hermenegildo, editors, Proceedings of the North American Conference on Logic Programming, pages 343–358. MIT Press, 1990.Google Scholar
  5. 5.
    L. Birkedal and M. Welinder. Hand-writing program generator generators. In M. Hermenegildo and J. Penjam, editors, Programming Language Implementation and Logic Programming. Proceedings, volume 844 of LNCS, pages 198–214, Madrid, Spain, 1994. Springer-Verlag.Google Scholar
  6. 6.
    R. Bol. Loop checking in partial deduction. Journal of Logic Programming, 16(1&2):25–46, 1993.Google Scholar
  7. 7.
    A. Bondorf, F. Frauendorf, and M. Richter. An experiment in automatic selfapplicable partial evaluation of prolog. Technical Report 335, Lehrstuhl Informatik V, University of Dortmund, 1990.Google Scholar
  8. 8.
    A. F. Bowers and C. A. Gurr. Towards fast and declarative meta-programming. In K. R. Apt and F. Turini, editors, Meta-logics and Logic Programming, pages 137–166. MIT Press, 1995.Google Scholar
  9. 9.
    M. Bruynooghe, D. De Schreye, and B. Martens. A general criterion for avoiding infinite unfolding during partial deduction. New Generation Computing, 11(1):47–79, 1992.Google Scholar
  10. 10.
    C. Consel and O. Danvy. Tutorial notes on partial evaluation. In Proceedings of POPL'93, Charleston, South Carolina, January 1993. ACM Press.Google Scholar
  11. 11.
    H. Fujita and K. Furukawa. A self-applicable partial evaluator and its use in incremental compilation. New Generation Computing, 6(2 & 3):91–118, 1988.Google Scholar
  12. 12.
    J. Gallagher. A system for specialising logic programs. Technical Report TR-91-32, University of Bristol, November 1991.Google Scholar
  13. 13.
    J. Gallagher. Tutorial on specialisation of logic programs. In Proceedings of PEPM'93, the ACM Sigplan Symposium on Partial Evaluation and Semantics-Based Program Manipulation, pages 88–98. ACM Press, 1993.Google Scholar
  14. 14.
    J. Gallagher and M. Bruynooghe. Some low-level transformations for logic programs. In M. Bruynooghe, editor, Proceedings of Meta90 Workshop on Meta Programming in Logic, pages 229–244, Leuven, Belgium, 1990.Google Scholar
  15. 15.
    J. Gallagher and M. Bruynooghe. The derivation of an algorithm for program specialisation. New Generation Computing, 9(3 & 4):305–333, 1991.Google Scholar
  16. 16.
    R. Glück and J. Jørgensen. Efficient multi-level generating extensions for program specialization. In Programming Languages, Implementations, Logics and Programs (PLILP'95), LNCS 982, pages 259–278. Springer-Verlag, 1995.Google Scholar
  17. 17.
    R. Glück, J. Jørgensen, B. Martens, and M. Sørensen. Controlling conjunctive partial deduction of definite logic programs. Technical Report CW 226, Departement Computerwetenschappen, K.U. Leuven, Belgium, February 1996. Submitted.Google Scholar
  18. 18.
    C. A. Gurr. A Self-Applicable Partial Evaluator for the Logic Programming Language Gödel. PhD thesis, Department of Computer Science, University of Bristol, January 1994.Google Scholar
  19. 19.
    M. Hermenegildo, R. Warren, and S. K. Debray. Global flow analysis as a practical compilation tool. The Journal of Logic Programming, 13(4):349–366, 1992.Google Scholar
  20. 20.
    P. Hill and J. Gallagher. Meta-programming in logic programming. Technical Report 94.22, School of Computer Studies, University of Leeds, 1994. To be published in Handbook of Logic in Artificial Intelligence and Logic Programming, Vol. 5. Oxford Science Publications, Oxford University Press.Google Scholar
  21. 21.
    C. K. Holst. Syntactic currying: yet another approach to partial evaluation. Technical report, DIKU, Department of Computer Science, University of Copenhagen, 1989.Google Scholar
  22. 22.
    C. K. Holst and J. Launchbury. Handwriting cogen to avoid problems with static typing. Working paper, 1992.Google Scholar
  23. 23.
    N. D. Jones, C. K. Gomard, and P. Sestoft. Partial Evaluation and Automatic Program Generation. Prentice Hall, 1993.Google Scholar
  24. 24.
    N. D. Jones, P. Sestoft, and H. Søndergaard. Mix: a self-applicable partial evaluator for experiments in compiler generation. LISP and Symbolic Computation, 2(1):9–50, 1989.Google Scholar
  25. 25.
    J. Jørgensen and M. Leuschel. Efficiently generating efficient generating extensions in Prolog. Technical Report CW 221, K.U. Leuven, Belgium, February 1996. Accessible via http://www.cs.kuleuven.ac.be/∼lpai.Google Scholar
  26. 26.
    J. Komorowski. An introduction to partial deduction. In A. Pettorossi, editor, Proceedings Meta'92, pages 49–69. Springer-Verlag, LNCS 649, 1992.Google Scholar
  27. 27.
    J. Launchbury. Projection Factorisations in Partial Evaluation. Distinguished Dissertations in Computer Science. Cambridge University Press, 1991.Google Scholar
  28. 28.
    M. Leuschel. Partial evaluation of the “real thing”. In L. Fribourg and F. Turini, editors, Logic Program Synthesis and Transformation — Meta-Programming in Logic. Proceedings of LOPSTR'94 and META '94, LNCS 883, pages 122–137, Pisa, Italy, June 1994. Springer-Verlag.Google Scholar
  29. 29.
    M. Leuschel. Ecological partial deduction: Preserving characteristic trees without constraints. In M. Proietti, editor, Logic Program Synthesis and Transformation. Proceedings of LOPSTR'95, LNCS 1048, pages 1–16, Utrecht, Netherlands, September 1995. Springer-Verlag.Google Scholar
  30. 30.
    M. Leuschel and D. De Schreye. An almost perfect abstraction operation for partial deduction using characteristic trees. Technical Report CW 215, K.U. Leuven, Belgium, October 1995. Submitted for Publication. Accessible via http://www.cs.kuleuven.ac.be/∼lpai.Google Scholar
  31. 31.
    M. Leuschel and D. De Schreye. Towards creating specialised integrity checks through partial evaluation of meta-interpreters. In Proceedings of PEPM'95, the ACM Sigplan Symposium on Partial Evaluation and Semantics-Based Program Manipulation, pages 253–263, La Jolla, California, June 1995. ACM Press.Google Scholar
  32. 32.
    M. Leuschel, D. De Schreye, and A. de Waal. A conceptual embedding of folding into partial deduction: Towards a maximal integration. Technical Report CW 225, Departement Computerwetenschappen, K.U. Leuven, Belgium, February 1996. Submitted.Google Scholar
  33. 33.
    M. Leuschel and B. Martens. Global control for partial deduction through characteristic atoms and global trees. In this volume.Google Scholar
  34. 34.
    M. Leuschel and B. Martens. Partial deduction of the ground representation and its application to integrity checking. In J. Lloyd, editor, Proceedings of ILPS'95, the International Logic Programming Symposium, pages 495–509, Portland, USA, December 1995. MIT Press. Extended version as Technical Report CW 210, K.U. Leuven. Accessible via http://www.cs.kuleuven.ac.be/lpai.Google Scholar
  35. 35.
    J. Lloyd. Foundations of Logic Programming. Springer Verlag, 1987.Google Scholar
  36. 36.
    J. W. Lloyd and J. C. Shepherdson. Partial evaluation in logic programming. The Journal of Logic Programming, 11:217–242, 1991.Google Scholar
  37. 37.
    B. Martens and D. De Schreye. Automatic finite unfolding using well-founded measures. Journal of Logic Programming, 1995. To Appear.Google Scholar
  38. 38.
    B. Martens and J. Gallagher. Ensuring global termination of partial deduction while allowing flexible polyvariance. In L. Sterling, editor, Proceedings ICLP'95, pages 597–613, Kanagawa, Japan, June 1995. MIT Press.Google Scholar
  39. 39.
    T. Mogensen and A. Bondorf. Logimix: A self-applicable partial evaluator for Prolog. In K.-K. Lau and T. Clement, editors, Logic Program Synthesis and Transformation. Proceedings of LOPSTR'92, pages 214–227. Springer-Verlag, 1992.Google Scholar
  40. 40.
    G. Neumann. Transforming interpreters into compilers by goal classification. In M. Bruynooghe, editor, Proceedings of Meta90 Workshop on Meta Programming in Logic, pages 205–217, Leuven, Belgium, 1990.Google Scholar
  41. 41.
    G. Neumann. A simple transformation from Prolog-written metalevel interpreters into compilers and its implementation. In A. Voronkov, editor, Logic Programming. Proceedings of the First and Second Russian Conference on Logic Programming, LNCS 592, pages 349–360. Springer-Verlag, 1991.Google Scholar
  42. 42.
    A. Pettorossi and M. Proietti. Transformation of logic programs: Foundations and techniques. The Journal of Logic Programming, 19 & 20:261–320, May 1994.Google Scholar
  43. 43.
    S. Prestwich. The PADDY partial deduction system. Technical Report ECRC-92-6, ECRC, Munich, Germany, 1992.Google Scholar
  44. 44.
    S. A. Romanenko. A compiler generator produced by a self-applicable specializer can have a surprisingly natural and understandable structure. In D. Bjørner, A. P. Ershov, and N. D. Jones, editors, Partial Evaluation and Mixed Computation, pages 445–463. North-Holland, 1988.Google Scholar
  45. 45.
    D. Sahlin. Mixtus: An automatic partial evaluator for full Prolog. New Generation Computing, 12(1):7–51, 1993.Google Scholar
  46. 46.
    M. Sørensen and R. Glück. An algorithm of generalization in positive supercompilation. In J. Lloyd, editor, Proceedings of ILPS'95, the International Logic Programming Symposium, pages 465–479, Portland, USA, December 1995. MIT Press.Google Scholar
  47. 47.
    V. Turchin. The concept of a supercompiler. ACM Transactions on Programming Languages and Systems, 8(3):292–325, 1986.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1996

Authors and Affiliations

  • Jesper Jørgensen
    • 1
  • Michael Leuschel
    • 1
  1. 1.Department of Computer ScienceK.U. LeuvenHeverleeBelgium

Personalised recommendations