Abstract
By combining binarization and elimination of metavariables we compile definite metaprograms to equivalent definite binary programs, while preserving first argument indexing. The transformation gives a faithful embedding of the essential ingredient of full Prolog to the more restricted class of binary definite programs while preserving a strong operational equivalence with the original program. The resulting binary programs can be executed efficiently on a considerably simplified WAM. We describe WAM-support that avoids increasing code size by virtualizing links between predicate and functor occurrences that result in the binarization process. To improve the space-efficiency of our run-time system we give a program transformation that simulates resourcedriven failure while keeping conditional answers. Then we describe the WAM-support needed to implement the transformation efficiently. We also discuss its applications to parallel execution of binary programs and as a surprisingly simple garbage collection technique that works in time proportional to the size of useful data.
Preview
Unable to display preview. Download preview PDF.
References
H. Ait-Kaci: “The WAM: A (Real) Tutorial”, Digital PRL, January 1990.
M.H.M. Cheng, M.H. van Emden, P.A. Strooper, “Complete Sets of Frontiers in Logic-based Program Transformation”, J.W. Lloyd (ed.), Proceedings of the Workshop on Meta-Programming in Logic Programming, p. 213–225, Bristol, 1988.
M.H.M. Cheng, M.H. van Emden, B.E. Richards: “On Warren's Method for Functional Programming in Logic”, D.H.D. Warren, P. Szeredi (eds.), Logic Programming Proceedings of The Seventh International Conference, p.546–561, MIT Press 1990.
B. Demoen, “On the transformation of a Prolog Program to a more efficient binary Program”, Report CW 130, December 1990, K.U.Leuven.
B. Demoen, A. Marien, “Implementation of Prolog as binary definite Programs”, Russian Conference of Logic Programming, September 1991.
T. Hickey, S. Mudambi: “Global Compilation of Prolog”, Journal of Logic Programming, 1989:7, p. 193–230.
G. Janssens, B. Demoen, A. Marien: “Improving the Register Allocation of WAM by Reordering Unification”, R. Kowalski, K.A. Bowen (eds.), Logic Programming: Proceedings of the Fifth International Conference and Symposium, p. 1388–1402, MIT Press, 1988”.
J.W. Lloyd, “Foundations of Logic Programming”,(2nd ed.), Springer-Verlag, 1987.
M.Meier: “Compilation of Compound Terms in Prolog”, S. Debray, M. Hermenegildo (eds.) Proceedings of the 1990 North American Conference, p.63–79, MIT Press 1990.
D. Maier, D.S. Warren, “Computing with Logic”, Benjamin/Cummings Publishing, 1988.
R.A. O'Keefe, “The Craft of Prolog”, MIT Press, 1990.
E. Shapiro, “Separating Concurrent Languages with Categories of Language Embeddings”, Tech. Report CS91-05, The Weizmann Institute of Science, March 1991.
T. Sato, H. Tamaki: “Existential Continuation”, New Generation Computing 6, p. 421–438, 1989.
A. Takeuchi, “Affinity between Meta Interpreters and Partial Evaluation”, ICOT Tech. Report TR-166, Institute for New Generation Computer Technology, Tokyo, 1986.
P. Tarau: “A Compact Definite Metaprogram Compiler Based on Program Transformations”, Tech. Report TR-91-1, Dept. d'Informatique, Université de Moncton, January 1991.
P. Tarau: “A Simplified Abstract Machine for the Execution of Binary Metaprograms”, Preceedings of the Logic Programming Conference'91, p. 119–128, ICOT, Tokyo 1991.
P. Tarau, M. Boyer: “Prolog Meta-Programming with Soft Databases”, Harvey Abramson and M.H. Rogers (eds.) Meta-Programming in Logic Programming, p. 365–382, MIT Press, 1989.
P. Tarau, M. Boyer: “Elementary Logic Programs”, P. Deransart, J. Maluszynski, (eds), Programming Language Implementation and Logic Programming, p.159–173, LNCS 456, Springer Verlag, 1990.
A. Takeuchi, K. Furukawa, “Partial Evaluation of Prolog Programs and its Application to Meta Programming”, ICOT Tech. Memorandum TM-0164, Institute for New Generation Computer Technology, Tokyo, 1986.
Z.D. Umrigar: “Finding Advantageous Orders for Argument Unification for the Prolog WAM”, S. Debray, M. Hermenegildo (eds.) Logic Programming: Proceedings of the 1990 North American Conference, p. 80–96, MIT Press 1990.
D.H.D. Warren, “Higher order extensions to PROLOG: are they needed”, Machine Intelligence 10, Ellis Horwood, 1982.
D.H.D. Warren: “An Abstract Prolog Instruction Set”, SRI International, 1983.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1992 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Tarau, P. (1992). Program transformations and WAM-support for the compilation of definite metaprograms. In: Voronkov, A. (eds) Logic Programming. Lecture Notes in Computer Science, vol 592. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-55460-2_35
Download citation
DOI: https://doi.org/10.1007/3-540-55460-2_35
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-55460-8
Online ISBN: 978-3-540-47083-0
eBook Packages: Springer Book Archive