Abstract
Metal-level compositions of object logic programs are naturally implemented by means of meta-programming techniques. Metainterpreters defining program compositions however suffer from a computational overhead that is due partly to the interpretation layer present in all meta-programs, and partly to the specific interpretation layer needed to deal with program compositions.
We show that meta-interpreters implementing compositions of object programs can be fruitfully specialised w.r.t. meta-level queries of the form Demo (E, G), where E denotes a program expression and G denotes a (partially instantiated) object level query. More precisely, we describe the design and implementation of declarative program specialiser that suitably transforms such meta-interpreters so as to sensibly reduce — if not to completely remove — the overhead due to the handling of program compositions. In many cases the specialiser succeeds in eliminating also the overhead due to meta-interpretation.
Similar content being viewed by others
References
Barklund, J., “Metaprogramming in Logic,” inEncyclopedia of Computer Science and Technology (A. Kent and J. G. Williams, eds.), Marcel Dekker, pp. 205–227, 1995.
Benkerimi, K. and Lloyd, J. W., “A Partial Evaluation Procedure for Logic Programs,” inLogic Programming: Proceedings of the 1990 North American Conference (S. Debray and M. Hermenegildo, eds.), Austin, Texas, October 1990, MIT Press, pp. 343–358, 1990.
Bowers, A. F. and Gurr, C. A., “Towards Fast and Declarative Meta-Programming,” inMeta-programming and Logic Programming (K. Apt and F. Turini, eds.), chapter 2, MIT Press, pp. 137–166, 1995.
Brogi, A. “Program Construction in Computational Logic,”Ph.D. thesis, Department of Computer Science, University of Pisa, 1993.
Brogi, A. and Contiero, S., “Composing Logic Programs by Meta-Programming in Gödel,” inMeta-programming and Logic Programming (K. Apt and F. Turini, eds.), chapter 7, MIT Press, pp. 167–194, 1995.
Brogi, A., Mancarella, P., Pedreschi, D., and Turini, F., “Modular Logic Programming,”ACM Transactions on Programming Languages and Systems, 16, 4, pp. 1361–1398, 1994.
Brogi, A., Renso, C., and Turini, F., “Amalgamating Language and Meta-Language for Composing Logic Programs,” inProceedings of the GULP-PRODE’94 Joint Conference on Declarative Programming (M. Alpuente, R. Barbuti, and I. Ramos, eds.),volume 2, pp. 408–422, 1994.
Brogi, A. and Turini, F., “Meta-Logic for Program Composition: Semantics Issues,” inMeta-logics and Logic Programming (K. R. Apt and F. Turini, eds.), chapter 4, MIT Press, pp. 83–110, 1995.
Bruynooghe, M., De Schreye, D., and Martens, B., “A General Criterion for Avoiding Infinite Unfolding during Partial Evaluation,”New Generation Computing, 11, 1, pp. 47–79, 1992.
Bugliesi, M., Lamma, E., and Mello, P., “Partial Deduction for Structured Logic Programming,”Journal of Logic Programming, 16, 1–2, pp. 89–122, 1993.
Costantini, S., Dell’Acqua, P., and Lanzarone, G. A., “Extending Horn Clauses Theories by Reflection Principles,” inLecture Notes in Artificial Intelligence, n. 838 (M. C. MacNish, D. Pearce, and L. M. Pereira, eds.), Springer-Verlag, pp. 400–413, 1994.
Falaschi, M., Levi, G., Martelli, M., and Palamidessi, C., “Declarative Modeling of the Operational Behavior of Logic Languages,”Theoretical Computer Science, 69, 3, pp. 289–318, 1989.
Futamura, Y., “Partial Computation of Programs,” inRIMS Symposia on Software Science and Engineering (G. Goos and J. Hartmanis, eds.),number 147 in LNCS, Springer-Verlag, pp. 1–35, 1982.
Gallagher, J., “Transforming Logic Programs by Specialising Interpreters,” inECAI-86, Proceedings of the 7th European Conference on Artificial Intelligence, Brighton, England, pp. 313–326, 1986.
Gallagher, J., “Tutorial on Specialisation of Logic Programs,” inProceedings PEPM93, ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation, ACM Press, pp. 88–98, 1993.
Gallagher, J. and Bruynooghe, M., “Some Low-Level Source Transformations for Logic Programs,” inProceedings of the Second Workshop on Meta-Programming in Logic (M. Bruynooghe, eds.), Katholieke Universiteit Leuven, Belgium, pp. 229–244, 1990.
Gallagher, J. and Bruynooghe, M., “The Derivation of an Alghorithm for Program Specialisation,”New Generation Computing, 9, 3–4, pp. 305–333, 1991.
Gallagher, J. P., “A System for Specialising Logic Program,”Technical Report, Tr-91-32, University of Bristol, 1991.
Gurr, C. A., “A Self-Applicable Partial Evaluator for the Logic Programming Language Gödel,”Ph.D. thesis, University of Bristol, 1994.
Hill, P. M. and Gallagher, J., “Meta-Programming in Logic Programming,” inHandbook of Logic in Artificial Intelligence and Logic Programming (A. Robinson and C. Hogger, eds.), chapter 5, Oxford University Press, 1996.
Hill, P. M. and Lloyd, J. W., “Analysis of Metaprogram,” inMetaprogramming in Logic Programming (H. D. Abramson and M. H. Rogers, eds.), MIT Press, pp. 23–52, 1989.
Hill, P. M. and Lloyd, J. M.,The Gödel Programming Language, MIT Press, 1994.
Jørgensen, J., Leuschel, M., and Martens, B., “Conjunctive Partial Deduction,” inProceedings of Sixth International Workshop on Logic Program Synthesis and Transformation LOPSTR-96 (J. Gallagher, eds.), pp. 46–62, 1996.
Komorowski, J., “An Introduction to Partial Deduction,” inMeta-Programming in Logic (A. Pettorossi, ed.), Uppsala, Sweden, June 1992 (Lecture Notes in Computer Science, vol. 649), Springer-Verlag, pp. 49–69, 1996.
Lamma, E., Mello, P., and Natali, A., “Reflection Mechanisms for Combining Prolog Databases,”Software: Practice and Experience, 21, 6, pp. 603–624, 1991.
Leuschel, M. and Martens, B., “Partial Deduction of the Ground Representation and Its Application to Integrity Checking”, inProceedings of ILPS’95, the International Logic Programming Symposium (J. Lloyd, ed.), MIT Press, pp. 495–509, 1995.
Leuschel, M. and Martens, B., “Global Control for Partial Deduction through Characteristic Atoms and Global Trees,” inProceedings of the 1996 Dagstuhl Seminar on Partial Evaluation, LNCS, 1110, pp. 263–283, 1996.
Leuschel, M. and De Schreye, D., “An Almost Perfect Abstract Operation for Partial Deduction Using Characteristic Trees,”Technical Report, CW 215, Katholieke Universiteit Leuven, October 1995.
Levi, G. and Sardu, G., “Partial Evaluation of Metaprograms in a “Multiple Worlds” Logic Language,”New Generation Computing, 6, 2–3, pp. 227–247, 1988.
Lloyd, J. W.,Foundations of Logic Programming, second edition, Springer-Verlag, 1987.
Lloyd, J. W. and Shepherdson, J. C., “Partial Evaluation in Logic Programming,”Journal of Logic Programming, 11, pp. 217–242, 1991.
Martens, B. and Gallagher, J., “Ensuring Global Termination of Partial Deduction while Allowing flexible Polyvariance,” inProceedings of ICLP95, the Twelfth International Conference on Logic Programming (L. Sterling, ed.), MIT Press, pp. 597–611, 1995.
Martens, B. and De Schreye, D., “Why Untyped Non-Ground Meta-Programming Is Not (Much of) a Problem,”Journal of Logic Programming, 22, 1, pp. 47–99, 1995.
Martens, B. and De Schreye, D., “Automatic Finite Unfolding Using Well-Founded Measures,” to appear inJournal of Logic Programming, 1996.
Martens, B., De Schreye, D., and Horváth, T., “Sound and Complete Partial Deduction with Unfolding Based on Well-Founded Measures,”Theoretical Computer Science, 122, 1–2, pp. 97–117, 1995.
Monteiro, L. and Porto, A., “Contextual Logic Programming,” inProceedings Sixth International Conference on Logic Programming (G. Levi and M. Martelli, eds.), MIT Press, pp. 284–302, 1989.
Owen, S., “Issues in the Partial Evaluation of Meta-Interpreters,” inMeta-Programming in Logic Programming (H. Abramson and M. H. Rogers, eds.), MIT Press, pp. 319–340, 1989.
Pettorossi, A. and Proietti, M., “Transformations of Logic Programs: Foundations and Techniques,”Journal of Logic Programming, 19 & 20, pp. 261–320, 1994.
Sahlin, D., “An Automatic Partial Evaluator for Full Prolog,”Ph.D. thesis, The Royal Institute of Technology (KTH), Department of Telecommunications and Computer Systems, Stockholm, Sweden, 1991.
Sørensen, M. and Glück, R., “An Algorithm of Generalization in Positive Supercompilation,” inProceedings of ILPS’95, the International Logic Programming Symposium (J. Lloyd, ed.), MIT Press, pp. 465–479, 1995.
Sterling, L. and Beer, R., “Metainterpreters for Expert System Construction,”Journal of Logic Programming, 6, pp. 163–178, 1989.
Sterling, L. and Shapiro, E.,The Art of Prolog, MIT Press, 1986.
Takeuchi, A., “Affinity between Meta Interpreters and Partial Evaluation,” inInformation Processing 86 (H.-J. Kugler, ed.), North-Holland, pp. 279–282, 1986.
Takeuchi, A. and Furukawa, K., “Partial Evaluation of Prolog Programs and Its Application to Meta-Programming,” inInformation Processing 86 (H.-J. Kugler, ed.), North-Holland, pp. 415–420, 1986.
Author information
Authors and Affiliations
Additional information
Antonio Brogi, Ph.D.: He is currently assistant professor in the Department of Computer Science at the University of Pisa, Italy. He received his Laurea Degree in Computer Science (1987) and his Ph. D. in Computer Science (1993) from the University of Pisa. His research interests include programming language design and semantics, logic programming, deductive databases, and software coordination.
Simone Contiero: He is currently a Ph. D. student at the Department of Computer Science, University of Pisa (Italy). He received his Laurea Degree in Computer Science from the University of Pisa in 1994. His research interests are in high-level programming languages, metaprogramming and logic-based coordination of software.
About this article
Cite this article
Brogi, A., Contiero, S. A program specialiser for meta-level compositions of logic programs. NGCO 16, 123–161 (1998). https://doi.org/10.1007/BF03037314
Received:
Revised:
Issue Date:
DOI: https://doi.org/10.1007/BF03037314