|Compiling Prolog-like languages email@example.com (Sarah Thompson) (2002-07-02)|
|Re: Compiling Prolog-like languages firstname.lastname@example.org (Bart Demoen) (2002-07-04)|
|Re: Compiling Prolog-like languages email@example.com (Torben Ęgidius Mogensen) (2002-07-04)|
|Re: Compiling Prolog-like languages firstname.lastname@example.org (Neelakantan Krishnaswami) (2002-07-04)|
|Re: Compiling Prolog-like languages email@example.com (Hans Aberg) (2002-07-04)|
|Re: Compiling Prolog-like languages firstname.lastname@example.org (Peter Ilberg) (2002-07-04)|
|Re: Compiling Prolog-like languages email@example.com (Roberto Waltman) (2002-07-04)|
|Re: Compiling Prolog-like languages firstname.lastname@example.org (Thomas Lindgren) (2002-07-15)|
|Re: Compiling Prolog-like languages email@example.com (Yiorgos Adamopoulos) (2002-07-15)|
|[6 later articles]|
|From:||"Torben Ęgidius Mogensen" <firstname.lastname@example.org>|
|Date:||4 Jul 2002 23:01:55 -0400|
|Organization:||Department of Computer Science, University of Copenhagen|
|Posted-Date:||04 Jul 2002 23:01:55 EDT|
"Sarah Thompson" <email@example.com> writes:
> Before I weigh into this and start reinventing considerable quantities
> of wheels, I thought it might make sense to ask some questions here.
> 1. Can someone point toward a good tutorial on implementing
> Prolog-like programming languages?
"Compiler Design" by Wilhelm & Maurer (Addison Wesley) has a fairly
detailed chapter on Prolog implementation. It uses a simple abstract
machine that is designed for simplicity rather than efficiency, but it
should give you a good idea of the issues.
Hassan Ait-Kaci's "Warren's Abstract Machine - a Tutorial
Reconstruction" (MIT Press) is a good description of the WAM.
> 2. Much of the literature mentions the Warren Abstract Machine. Is
> this regarded as the best way to go, or are there
> simpler/faster/better/newer alternatives worthy of consideration?
Simpler, certainly. Faster, maybe. But most of the speed of the fast
Prolog compilers is not due to abstract machine choice, but due to the
amount of optimizations done. There is no all-around best choice, it
depends on your needs and how much time you want to invest in the
> 3. I currently use C++ as a target language, although this is intended
> to be an interim step toward a lower level code generator. Is this
> likely to be good/bad/indifferent as regards implementing a WAM or
> something similar to it?
C++ is overkill, but C would be O.K. The main problem is the lack of
label pointers (useful for backtrack points etc.). GCC has these
added, so if you use that you can be fine. You could use function
pointers instead, but that makes tail-call optimization harder.
An alternative is to write an interpreter for an abstract machine.
Unless your problems are very speed critical, the reduction in speed
shouldn't be problematical.
Torben Mogensen (firstname.lastname@example.org)
Return to the
Search the comp.compilers archives again.