Related articles |
---|
Prolog interpreter with flex and bison ... eliasb@dai.ed.ac.uk (Elias Biris) (1997-01-29) |
Re: Prolog interpreter with flex and bison ... dwight@pentasoft.com (1997-02-11) |
From: | dwight@pentasoft.com (Dwight VandenBerghe) |
Newsgroups: | comp.compilers |
Date: | 11 Feb 1997 22:08:43 -0500 |
Organization: | AccessOne |
References: | 97-01-222 |
Keywords: | prolog, design |
On 29 Jan 1997 11:20:24 -0500, Elias Biris <eliasb@dai.ed.ac.uk>
wrote:
>My trouble sofar has to do with how to do the variables' binding in a
>way similar to Prolog.
Unless I am missing something here, what you are faced with is
unification, not binding. The straight-forward way to do this is at
runtime, not at compile time. A given argument to a Prolog clause
might take on different "types" depending on who called it, and with
what parameter. You test these at runtime with a sort of switch
statement. Maybe the thing to do is to find a copy of David Warren's
old paper on the WAM (Warren Abstract Machine) and try to generate
code for it, instead of compiled code. I wrote a Prolog compiler into
WAM code back in the mid-eighties for DOE, albeit in Awk (!!), but
most of the details escape me. It wasn't that hard - it took ten
days, as I remember. If my memory about unification is misleading me
here, perhaps someone with more currently firing brain cells in this
area is welcome to jump and and set the story straight!
Dwight
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.