Skip to main content

Compiling logic programs with equality

  • Integration Of Logic Programming And Functional Programming
  • Conference paper
  • First Online:
Programming Language Implementation and Logic Programming (PLILP 1990)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 456))

Abstract

Horn clause logic with equality is an amalgamation of functional and logic programming languages. A sound and complete operational semantics for logic programs with equality is based on resolution to solve literals, and rewriting and narrowing to evaluate functional expressions. This paper proposes a technique for compiling programs with these inference rules into programs of a low-level abstract machine which can be efficiently executed on conventional architectures. The presented approach is based on an extension of the Warren abstract machine (WAM). In our approach pure logic programs without function definitions are compiled in the same way as in the WAM-approach, and for logic programs with function definitions particular instructions are generated for occurrences of functions inside clause bodies. In order to obtain an efficient implementation of functional computations, a stack of occurrences of function symbols in goals is managed by the abstract machine. The compiler generates the necessary instructions for the efficient manipulation of the occurrence stack from the given equational logic programs.

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. P.G. Bosco, C. Cecchi, and C. Moiso. An extension of WAM for K-LEAF: a WAM-based compilation of conditional narrowing. In Proc. Sixth International Conference on Logic Programming (Lisboa), pp. 318–333. MIT Press, 1989.

    Google Scholar 

  2. H. Bertling and H. Ganzinger. Completion-Time Optimization of Rewrite-Time Goal Solving. In Proc. of the Conference on Rewriting Techniques and Applications, pp. 45–58. Springer LNCS 355, 1989.

    Google Scholar 

  3. P.G. Bosco, E. Giovannetti, and C. Moiso. Refined strategies for semantic unification. In Proc. of the TAPSOFT '87, pp. 276–290. Springer LNCS 250, 1987.

    Google Scholar 

  4. W.F. Clocksin and C.S. Mellish. Programming in Prolog. Springer, third rev. and ext. edition, 1987.

    Google Scholar 

  5. S.K. Debray. Register Allocation in a Prolog Machine. In Proc. IEEE Internat. Symposium on Logic Programming, pp. 267–275, Salt Lake City, 1986.

    Google Scholar 

  6. D. DeGroot and G. Lindstrom, editors. Logic Programming, Functions, Relations, and Equations. Prentice Hall, 1986.

    Google Scholar 

  7. M.J. Fay. First-Order Unification in an Equational Theory. In Proc. 4th Workshop on Automated Deduction, pp. 161–167, Austin (Texas), 1979. Academic Press.

    Google Scholar 

  8. L. Fribourg. SLOG: A Logic Programming Language Interpreter Based on Clausal Superposition and Rewriting. In Proc. IEEE Internat. Symposium on Logic Programming, pp. 172–184, Boston, 1985.

    Google Scholar 

  9. J.A. Goguen and J. Meseguer. Eqlog: Equality, Types, and Generic Modules for Logic Programming. In D. DeGroot and G. Lindstrom, editors, Logic Programming, Functions, Relations, and Equations, pp. 295–363. Prentice Hall, 1986.

    Google Scholar 

  10. M. Hanus. Formal Specification of a Prolog Compiler. In Proc. of the Workshop on Programming Language Implementation and Logic Programming, pp. 273–282, Orléans, 1988. Springer LNCS 348.

    Google Scholar 

  11. M. Hanus. Horn Clause Specifications with Polymorphic Types. Dissertation, FB Informatik, Univ. Dortmund, 1988.

    Google Scholar 

  12. M. Hanus. A Functional and Logic Language with Polymorphic Types. In Proc. Int. Symposium on Design and Implementation of Symbolic Computation Systems, pp. 215–224. Springer LNCS 429, 1990.

    Google Scholar 

  13. T. Heuillard. Compiling conditional rewriting systems. In Proc. 1st Int. Workshop on Conditional Term Rewriting Systems, pp. 111–128. Springer LNCS 308, 1987.

    Google Scholar 

  14. S. Hölldobler. From Paramodulation to Narrowing. In Proc. 5th Conference on Logic Programming & 5th Symposium on Logic Programming (Seattle), pp. 327–342, 1988.

    Google Scholar 

  15. J.-M. Hullot. Canonical Forms and Unification. In Proc. 5th Conference on Automated Deduction, pp. 318–334. Springer LNCS 87, 1980.

    Google Scholar 

  16. M. Huber and I. Varsek. Extended Prolog with Order-Sorted Resolution. In Proc. 4th IEEE Internat. Symposium on Logic Programming, pp. 34–43, San Francisco, 1987.

    Google Scholar 

  17. A. Josephson and N. Dershowitz. An Implementation of Narrowing. Journal of Logic Programming (6), pp. 57–77, 1989.

    Google Scholar 

  18. G. Janssens, B. Demoen, and A. Marien. Improving the Register Allocation in WAM by Reordering Unification. In Proc. 5th Conference on Logic Programming & 5th Symposium on Logic Programming (Seattle), pp. 1388–1402. MIT Press, 1988.

    Google Scholar 

  19. H. Kuchen, R. Loogen, J.J. Moreno-Navarro, and M. Rodríguez-Artalejo. Graph-based Implementation of a Functional Logic Language. In Proc. ESOP 90, pp. 271–290. Springer LNCS 432, 1990.

    Google Scholar 

  20. P. Padawitz. Computing in Horn Clause Theories, volume 16 of EATCS Monographs on Theoretical Computer Science. Springer, 1988.

    Google Scholar 

  21. Projektgruppe PILS. Zwischenbericht der Projektgruppe PILS. Univ. Dortmund, 1990.

    Google Scholar 

  22. D.H.D. Warren. An Abstract Prolog Instruction Set. Technical Note 309, SRI International, Stanford, 1983.

    Google Scholar 

  23. A. Yamamoto. A Theoretical Combination of SLD-Resolution and Narrowing. In Proc. Fourth International Conference on Logic Programming (Melbourne), pp. 470–487. MIT Press, 1987.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Pierre Deransart Jan Maluszyński

Rights and permissions

Reprints and permissions

Copyright information

© 1990 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Hanus, M. (1990). Compiling logic programs with equality. In: Deransart, P., Maluszyński, J. (eds) Programming Language Implementation and Logic Programming. PLILP 1990. Lecture Notes in Computer Science, vol 456. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0024197

Download citation

  • DOI: https://doi.org/10.1007/BFb0024197

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-53010-7

  • Online ISBN: 978-3-540-46298-9

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics