Abstract
Narrowing, the evaluation mechanism of functional logic languages, can be seen as a generalization of reduction, the evaluation mechanism of purely functional languages. The unidirectional pattern matching, which is used for parameter passing in functional languages, is simply replaced by the bidirectional unification known from logic programming languages. We show in this paper, how to extend a reduction machine, that has been designed for the evaluation of purely functional programs to a machine that performs narrowing. The necessary extensions concern the realization of unification and backtracking. The latter has to be incorporated to handle nondeterministic computations. It turns out that the resulting narrowing machine can also be seen as an extension of Warren's Prolog engine [Warren 83]. This extension enables a space efficient handling of nested expressions and embodies an optimized treatment of deterministic computations. As in Warren's machine the central component of the machine is a stack that contains environments, i.e. activation records of function calls, and choice points to keep track of possible alternative computations. It is ensured that choice points always contain the minimal amount of information that is necessary to restore a previous state on backtracking. A complete specification of the machine and of the translation of a sample language into abstract machine code is given. To test the feasibility of the new implementation technique a preliminary implementation has been developed in Miranda.
Chapter PDF
Similar content being viewed by others
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
G.P.Balboni, P.G.Bosco, C.Cecchi, R.Melen, C.Moiso, G.Sofi: Implementation of a Parallel Logic Plus Functional Language, in: P.Treleaven (ed.), Parallel Computers: Object Oriented, Functional and Logic, Wiley 1989.
M. Bellia, G. Levi: The Relation between Logic and Functional Languages, Journal of Logic Programming, Vol.3, 1986, 217–236.
P.G.Bosco, C.Cecchi, C.Moiso: An extension of WAM for K-LEAF: A WAM-based compilation of conditional narrowing, Int. Conf. on Logic Programming, Lisboa, 1989.
D.DeGroot, G.Lindstrom (eds.): Logic Programming: Functions, Relations, Equations, Prentice Hall 1986.
A.J.Field, P.G.Harrison: Functional Programming, Addison-Wesley 1988.
H.Kuchen, R.Loogen, J.J. Moreno-Navarro, M.Rodríguez-Artalejo: Graph-based Implementation of a Functional Logic Language, European Symposium on Programming 1990, LNCS 432, Springer Verlag 1990.
G. Lindstrom: Implementing logical variables on a graph reduction architecture, Workshop on Graph Reduction, LNCS 279, Springer Verlag 1987, 382–400.
R.Loogen, H.Kuchen, K.Indermark, W.Damm: Distributed Implementation of Programmed Graph Reduction, Conf. on Parallel Architectures and Languages Europe 1989, LNCS 365, Springer Verlag 1989.
J.J.Moreno-Navarro, M.Rodríguez-Artalejo: BABEL: A functional and logic programming language based on constructor discipline and narrowing, Conference on Algebraic and Logic Programming 1988, LNCS 343, Springer Verlag 1989.
J.J.Moreno-Navarro, M.Rodríguez-Artalejo: Logic Programming with Functions and Predicates: The Language BABEL, Technical Report DIA/89/3, Universidad Complutense, Madrid 1989, to appear in the Journal of Logic Programming.
J.J.Moreno-Navarro, H.Kuchen, R.Loogen, M.Rodríguez-Artalejo: Lazy Narrowing in a Graph Machine, Conference on Algebraic and Logic Programming 1990, LNCS 463, Springer Verlag 1990.
U.S.Reddy: Narrowing as the Operational Semantics of Functional Languages, IEEE Int. Symp. on Logic Programming, IEEE Computer Society Press, July 1985, 138–151.
U.S. Reddy: Functional Logic Languages, Part I, Workshop on Graph Reduction, LNCS 279, Springer Verlag 1987, 401–425.
D.H.D. Warren: An Abstract Prolog Instruction Set, Technical Note 309, SRI International, Menlo Park, California, October 1983.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1991 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Loogen, R. (1991). From reduction machines to narrowing machines. In: Abramsky, S., Maibaum, T.S.E. (eds) TAPSOFT '91. TAPSOFT 1991. Lecture Notes in Computer Science, vol 494. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3540539816_80
Download citation
DOI: https://doi.org/10.1007/3540539816_80
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-53981-0
Online ISBN: 978-3-540-46499-0
eBook Packages: Springer Book Archive