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.

Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.