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.
Preview
Unable to display preview. Download preview PDF.
References
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.
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.
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.
W.F. Clocksin and C.S. Mellish. Programming in Prolog. Springer, third rev. and ext. edition, 1987.
S.K. Debray. Register Allocation in a Prolog Machine. In Proc. IEEE Internat. Symposium on Logic Programming, pp. 267–275, Salt Lake City, 1986.
D. DeGroot and G. Lindstrom, editors. Logic Programming, Functions, Relations, and Equations. Prentice Hall, 1986.
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.
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.
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.
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.
M. Hanus. Horn Clause Specifications with Polymorphic Types. Dissertation, FB Informatik, Univ. Dortmund, 1988.
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.
T. Heuillard. Compiling conditional rewriting systems. In Proc. 1st Int. Workshop on Conditional Term Rewriting Systems, pp. 111–128. Springer LNCS 308, 1987.
S. Hölldobler. From Paramodulation to Narrowing. In Proc. 5th Conference on Logic Programming & 5th Symposium on Logic Programming (Seattle), pp. 327–342, 1988.
J.-M. Hullot. Canonical Forms and Unification. In Proc. 5th Conference on Automated Deduction, pp. 318–334. Springer LNCS 87, 1980.
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.
A. Josephson and N. Dershowitz. An Implementation of Narrowing. Journal of Logic Programming (6), pp. 57–77, 1989.
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.
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.
P. Padawitz. Computing in Horn Clause Theories, volume 16 of EATCS Monographs on Theoretical Computer Science. Springer, 1988.
Projektgruppe PILS. Zwischenbericht der Projektgruppe PILS. Univ. Dortmund, 1990.
D.H.D. Warren. An Abstract Prolog Instruction Set. Technical Note 309, SRI International, Stanford, 1983.
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.
Author information
Authors and Affiliations
Editor information
Rights 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