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.
Supported by HCM Network “Logic Program Synthesis and Transformation”.
Supported by the Belgian GOA “Non-Standard Applications of Abstract Interpretation”
Preview
Unable to display preview. Download preview PDF.
References
L. O. Andersen. Program Analysis and Specialization for the C Programming Language. PhD thesis, DIKU, University of Copenhagen, May 1994. (DIKU report 94/19).
L. Beckman, A. Haraldson, ö. Oskarsson, and E. Sandewall. A partial evaluator and its use as a programming tool. Artificial Intelligence, 7:319–357, 1976.
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.
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.
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.
R. Bol. Loop checking in partial deduction. Journal of Logic Programming, 16(1&2):25–46, 1993.
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.
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.
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.
C. Consel and O. Danvy. Tutorial notes on partial evaluation. In Proceedings of POPL'93, Charleston, South Carolina, January 1993. ACM Press.
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.
J. Gallagher. A system for specialising logic programs. Technical Report TR-91-32, University of Bristol, November 1991.
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.
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.
J. Gallagher and M. Bruynooghe. The derivation of an algorithm for program specialisation. New Generation Computing, 9(3 & 4):305–333, 1991.
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.
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.
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.
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.
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.
C. K. Holst. Syntactic currying: yet another approach to partial evaluation. Technical report, DIKU, Department of Computer Science, University of Copenhagen, 1989.
C. K. Holst and J. Launchbury. Handwriting cogen to avoid problems with static typing. Working paper, 1992.
N. D. Jones, C. K. Gomard, and P. Sestoft. Partial Evaluation and Automatic Program Generation. Prentice Hall, 1993.
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.
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.
J. Komorowski. An introduction to partial deduction. In A. Pettorossi, editor, Proceedings Meta'92, pages 49–69. Springer-Verlag, LNCS 649, 1992.
J. Launchbury. Projection Factorisations in Partial Evaluation. Distinguished Dissertations in Computer Science. Cambridge University Press, 1991.
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.
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.
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.
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.
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.
M. Leuschel and B. Martens. Global control for partial deduction through characteristic atoms and global trees. In this volume.
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.
J. Lloyd. Foundations of Logic Programming. Springer Verlag, 1987.
J. W. Lloyd and J. C. Shepherdson. Partial evaluation in logic programming. The Journal of Logic Programming, 11:217–242, 1991.
B. Martens and D. De Schreye. Automatic finite unfolding using well-founded measures. Journal of Logic Programming, 1995. To Appear.
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.
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.
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.
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.
A. Pettorossi and M. Proietti. Transformation of logic programs: Foundations and techniques. The Journal of Logic Programming, 19 & 20:261–320, May 1994.
S. Prestwich. The PADDY partial deduction system. Technical Report ECRC-92-6, ECRC, Munich, Germany, 1992.
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.
D. Sahlin. Mixtus: An automatic partial evaluator for full Prolog. New Generation Computing, 12(1):7–51, 1993.
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.
V. Turchin. The concept of a supercompiler. ACM Transactions on Programming Languages and Systems, 8(3):292–325, 1986.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1996 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Jørgensen, J., Leuschel, M. (1996). Efficiently generating efficient generating extensions in prolog. 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_12
Download citation
DOI: https://doi.org/10.1007/3-540-61580-6_12
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