Hi Frank,
Using separate conexts is a nice idea :)
Thanks!
Your interpreter works fine for all my basic tests except one:
test: {
fact(0,1).
fact(N,F) :- N > 0, N1 is N-1, fact(N1,F1), F is N * F1.
}
>> consult test
>> pl-interact
REBLog>> fact(5,X).
*CRASH*
Gisle
On Fri, 23 Mar 2001, Frank Sievertsen wrote:
> Hi!
>
> Interesting. I already wrote a simple Prolog-Interpreter, maybe you like
> the ideas I used. I am not renaming the words but using own contexts for
> them. Try it with the latest /Core xper, if you want. There are a few no
> longer needed parts (because RT repaired a few GC-Bugs :)))
>
> Have a look at
> http://proton.cl-ki.uni-osnabrueck.de/REBOL/reblog.r
>
> And try
> >> do http://proton...../reblog.r
> >> pl-interact
>
> REBlog >> assert(a(X):-b(X)).
> ('. ('assert (:- ('a X) ('b X))) 'trace)
>
> X = X
> Retry?y
> == no
>
> REBlog >> assert(b(test)).
> ('. ('assert ('b 'test)) 'trace)
>
> == yes
>
> REBlog >> a(X).
> ('. ('a X) 'trace)
>
> X = test
> Retry?y
> == no
>
>
> CU,
> Frank
>
> > I'm writing a simple Prolog interpreter where the format of the rules are
> > like this:
> >
> > [[father 'Bill 'Bob]]
> > [[mother 'Ann 'Bob]]
> >
> > [[parent x y] [father x y]]
> > [[parent x y] [mother x y]]
> >
> > [[grandparent x y] [parent x z] [parent z y]]
> >
> > And so on.
> >
> > Variables must be renamed before unification to aviod name clashes.
> > For example, [[parent x y] [father x y]] could become
> > [[parent _x20 _y15] [father _x20 _y15]]
> >
>
>
--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the
subject, without the quotes.