Skip to main content

Program transformations and WAM-support for the compilation of definite metaprograms

  • Conference paper
  • First Online:
Logic Programming

Part of the book series: Lecture Notes in Computer Science ((LNAI,volume 592))

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. H. Ait-Kaci: “The WAM: A (Real) Tutorial”, Digital PRL, January 1990.

    Google Scholar 

  2. 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.

    Google Scholar 

  3. 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.

    Google Scholar 

  4. B. Demoen, “On the transformation of a Prolog Program to a more efficient binary Program”, Report CW 130, December 1990, K.U.Leuven.

    Google Scholar 

  5. B. Demoen, A. Marien, “Implementation of Prolog as binary definite Programs”, Russian Conference of Logic Programming, September 1991.

    Google Scholar 

  6. T. Hickey, S. Mudambi: “Global Compilation of Prolog”, Journal of Logic Programming, 1989:7, p. 193–230.

    Google Scholar 

  7. 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”.

    Google Scholar 

  8. J.W. Lloyd, “Foundations of Logic Programming”,(2nd ed.), Springer-Verlag, 1987.

    Google Scholar 

  9. 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.

    Google Scholar 

  10. D. Maier, D.S. Warren, “Computing with Logic”, Benjamin/Cummings Publishing, 1988.

    Google Scholar 

  11. R.A. O'Keefe, “The Craft of Prolog”, MIT Press, 1990.

    Google Scholar 

  12. E. Shapiro, “Separating Concurrent Languages with Categories of Language Embeddings”, Tech. Report CS91-05, The Weizmann Institute of Science, March 1991.

    Google Scholar 

  13. T. Sato, H. Tamaki: “Existential Continuation”, New Generation Computing 6, p. 421–438, 1989.

    Google Scholar 

  14. A. Takeuchi, “Affinity between Meta Interpreters and Partial Evaluation”, ICOT Tech. Report TR-166, Institute for New Generation Computer Technology, Tokyo, 1986.

    Google Scholar 

  15. P. Tarau: “A Compact Definite Metaprogram Compiler Based on Program Transformations”, Tech. Report TR-91-1, Dept. d'Informatique, Université de Moncton, January 1991.

    Google Scholar 

  16. 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.

    Google Scholar 

  17. 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.

    Google Scholar 

  18. 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.

    Google Scholar 

  19. 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.

    Google Scholar 

  20. 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.

    Google Scholar 

  21. D.H.D. Warren, “Higher order extensions to PROLOG: are they needed”, Machine Intelligence 10, Ellis Horwood, 1982.

    Google Scholar 

  22. D.H.D. Warren: “An Abstract Prolog Instruction Set”, SRI International, 1983.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

A. Voronkov

Rights and permissions

Reprints 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

Publish with us

Policies and ethics