Skip to main content

A WAM compilation scheme

  • Conference paper
  • First Online:
Logic Programming

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

Abstract

In order to ease the compilation of logic programs, source-to-source transformations are applied to obtain still declarative programs. The horizontal compilation consists of grouping clauses together, performing a flattening process to remove nested compound terms, partially evaluating them, and reordering the constraints followed by variable classification. The constraints are mapped onto a single ≐-primitive.

For the resulting, very concise representation we present the vertical compilation rules for generating WAM code. They can be further optimized taking type inference information into account.

The work of the second author is carried out as part of the ARC-TEC project, supported by BMFT under grant ITW 8902 C4.

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. Aït-Kaci and R. Nasr. LOGIN: A Logic Programming Language with Built-in Inheritance. Journal of Logic Programming, 3:185–215, 1986.

    Article  Google Scholar 

  2. M. Bruynooghe and G. Jennsens. An Instance of Abstract Interpretation Integrating Type and Mode Inferencing. In R. A. Kowalski and K. A. Bowen, editors, Proceedings of the Fifth International Conference and Symposium on Logic Programming, pages 669–683, 1988.

    Google Scholar 

  3. W. Büttner and H. Simonis. Embedding Boolean Expressions into Logic Programming. Journal of Symbolic Computation, 4:191–205, 1987.

    Google Scholar 

  4. M. Carlsson. On the Efficiency of Optimising Shallow Backtracking in Compiled Prolog. In G. Levi and M. Martelli, editors, Proc. of the Sixth ICLP, pages 3–16. MIT Press, 1989.

    Google Scholar 

  5. K. Clark. Negation as Failure. In H. Gallaire and J. Minker, editors, Logic and Databases, pages 293–322. Plenum Press, New York, 1978.

    Google Scholar 

  6. R. M. Colomb. Enhancing Unification in Prolog through Clause Indexing. Journal of Logic Programming, 10:23–44, 1991.

    MathSciNet  Google Scholar 

  7. S. K. Debray. Register Allocation in a Prolog Machine. In Symposium on Logic Programming, pages 267–275. IEEE, 9 1986.

    Google Scholar 

  8. S. K. Debray. A Simple Code Improvement Scheme for Prolog. In G. Levi and M. Martelli, editors, Proc. of the Sixth ICLP, pages 17–32. MIT Press, 1989.

    Google Scholar 

  9. S. K. Debray and D. S. Warren. Detection and optimization of functional computations in prolog. In E. Shapiro, editor, Third International Conference on Logic Programming, number 225 in Lecture Notes in Computer Science, pages 490–504. Springer, 1986.

    Google Scholar 

  10. T. Hickey and S. Mudambi. Global Compilation of Prolog. Journal of Logic Programming, 7:193–230, 1989.

    Article  Google Scholar 

  11. M. Höhfeld and G. Smolka. Definite Relations over Constraint Languages. LILOG-Report 53, IBM Deutschland GmbH, WT LILOG, Dept. 3504, P.O. Box 800880, D-7000 Stuttgart 80, Germany, October 1988. To appear in Journal of Logic Programming.

    Google Scholar 

  12. J. Jaffar and J.-L. Lassez. Constraint Logic Programming. In Proceedings of Principles of Programming Languages, pages 111—119, 1987.

    Google Scholar 

  13. J. Jaffar, S. Michaylov, P. Stuckey, and R. Yap. The CLP(R) Language and System. Technical Report CMU-CS-90-181, School of Computer Science, Carnegie Mellon University, Pittsburgh, PA, October 1990.

    Google Scholar 

  14. G. Janssens, B. Demoen, and A. Marten. Improving the Register allocation in WAM by Reordering Unification. In R. A. Kowalski and K. A. Bowen, editors, Proceedings of the Fifth International Conference and Symposium on Logic Programming, pages 1388–1402, 1988.

    Google Scholar 

  15. L. Matyska, A. Jergová, and D. Toman. Register Allocation in WAM. In K. Furukawa, editor, Proc. of the Eighth ICLP, pages 142—156, 1991.

    Google Scholar 

  16. M. Meier. Compilation of Compound Terms in Prolog. In S. Debray and M. Hermenegildo, editors, North American Conference on Logic Programming, pages 63–79. MIT Press, October 1990.

    Google Scholar 

  17. U. Neumerkel. Extensible Unification by Metastructures. In M. Bruynooghe, editor, Proceedings of the Second Workshop on Meta-programming in Logic, pages 352–364, 1990.

    Google Scholar 

  18. D. Sahlin. An Automatic Partial Evaluator for Full Prolog. PhD thesis, The Royal Institute of Technology, Stockholm, March 1991.

    Google Scholar 

  19. A. Taylor. Removal of Dereferencing and Trailing in Prolog Compilation. In G. Levi and M. Martelli, editors, Proc. of the Sixth ICLP, pages 48–62. MIT Press, 1989.

    Google Scholar 

  20. A. Taylor. Quicksort Speed in Prolog. USENET electronic article in comp.lang.prolog, July 1990.

    Google Scholar 

  21. A. Taylor. High Performance Prolog Implementation, PhD thesis, University of Sydney, June 1991.

    Google Scholar 

  22. A. K. Turk. Compiler Optimizations for the WAM. In E. Shapiro, editor, Third International Conference on Logic Programming, number 225 in Lecture Notes in Computer Science, pages 657–662. Springer, 1986.

    Google Scholar 

  23. P. van Hentenryck. Constraint Satisfaction in Logic Programming. MIT Press, 1989.

    Google Scholar 

  24. P. van Roy. A Prolog Compiler for the PLM. Technical Report UCB/CSD 84/203, University of California, Computer Science Division, University of California, Berkeley, California 94720, November 1984.

    Google Scholar 

  25. P. van Roy. An Intermediate Language to Support Prolog's Unification. In E. L. Lusk and R. A. Overbeek, editors, Proceedings of the North American Conference on Logic Programming, pages 1148–1164, 1989.

    Google Scholar 

  26. D. H. D. Warren. An Abstract Prolog Instruction Set. Technical Note 309, Artificial Intelligence Center, SRI International, 333 Ravenswood Ave, Menlo Park, CA 94025, October 1983.

    Google Scholar 

  27. R. Warren, M. Hermenegildo, and S. K. Debray. On the Practicality of Global Flow Analysis of Logic Programs. In R. A. Kowalski and K. A. Bowen, editors, Proc. of the Fifth International Conference and Symposium on Logic Programming, pages 684–699, 1988.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Hans -Günther Hein .

Editor information

A. Voronkov

Rights and permissions

Reprints and permissions

Copyright information

© 1992 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Hein, H.G., Meyer, M. (1992). A WAM compilation scheme. 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_15

Download citation

  • DOI: https://doi.org/10.1007/3-540-55460-2_15

  • 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