| OCR Text |
Show APPENDIX A CODE LISTING OF A SIMPLE FUNLOG INTERPRETER The interpreter presented here is a very much simplified version in that the algorithms of the semantic unification algorithm, the biased semantic unification algorithm, and the procedure One_ Step_ Reduction are not explicitly implemented, but are simulated in a simple blind try-and-fail manner. This results in a very simple, but slow interpreter. A complete interpreter has been implemented by Dong DeGroot's group of IBM at Yorktown Heights, which appears in [ 115]. op(550, xfx, ==>). funlog(true) :- !. funlog((A, B)) :- !, funlog(A), funlog(reduce(Term, R)) :- funlog(B). !, reduce(Term, R). funlog(P) .- clause(P, Body), funlog(Body). funlog(P) :- P. funlog(P) :- !, P -·· [PrediTerm], reduce_inner(Term, NewTerm), PP -·· [PrediNewTerm], (P \== PP -> funlog(PP); fail), ! . I* reduce function *I I* terms directly *I I* normal Prolog *I I* invoke Prolog built-in *I I* Prolog cannot solve *I I* here goes Funlog */ I* if P == PP then *I I* nothing can be reduced *I I* function reductions do not backtrack *I reduce_inner([], []) :- !. I* succeed if one of the *I reduce_inner([AIL], [A1IL1]) :- I* subterms is reduced *I !, reduce_one{A, A1), {A == A1 -> reduce_inner{L, L1); L = L1). |