Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Prolog compiler in Prolog?

83 views
Skip to first unread message

gerald....@gmail.com

unread,
Oct 8, 2011, 5:32:53 PM10/8/11
to
Is there a Prolog compiler written in Prolog? If so, where can I get it? If not, why not?

Sergey Dymchenko

unread,
Oct 8, 2011, 6:34:50 PM10/8/11
to
On Oct 9, 12:32 am, gerald.brit...@gmail.com wrote:
> Is there a Prolog compiler written in Prolog?  If so, where can I get it?  If not, why not?

The kernel of ECLiPSe (http://eclipseclp.org) is an efficient
implementation of standard (Edinburgh-like) Prolog - incremental
compiler to virtual machine code. Since version 6 compiler itself is
written in Prolog.

bart demoen

unread,
Oct 9, 2011, 9:45:51 AM10/9/11
to
On Sat, 08 Oct 2011 14:32:53 -0700, gerald.britton wrote:

> Is there a Prolog compiler written in Prolog? If so, where can I get
> it? If not, why not?

Apart from ECLiPSe, also XSB, GNU-Prolog, Ciao, jProlog and hProlog have a
compiler written in Prolog: they are all available on the net.
(and there might be others)
B-Prolog's compiler is written in B-Prolog AFAIK, the SICStus Prolog
compiler is written in SICStus Prolog - not available for free.

Cheers

Bart Demoen

--- Posted via news://freenews.netfront.net/ - Complaints to ne...@netfront.net ---

Jan Wielemaker

unread,
Oct 9, 2011, 10:48:01 AM10/9/11
to
On 2011-10-09, bart demoen <bart....@cs.kuleuven.be> wrote:
> On Sat, 08 Oct 2011 14:32:53 -0700, gerald.britton wrote:
>
>> Is there a Prolog compiler written in Prolog? If so, where can I get
>> it? If not, why not?
>
> Apart from ECLiPSe, also XSB, GNU-Prolog, Ciao, jProlog and hProlog have a
> compiler written in Prolog: they are all available on the net.
> (and there might be others)
> B-Prolog's compiler is written in B-Prolog AFAIK, the SICStus Prolog
> compiler is written in SICStus Prolog - not available for free.

Just wondering, which systems compile dynamic code in (practically) the
same way as static code? I can say that SWI-Prolog does this. Its
compiler is written in C. I'm not sure what I would use if I had to make
this decision again. Pattern-matching is surely a lot more practical in
Prolog. On the other hand, keeping track of annotations about variables
(allocation, initialisation status, etc.) is typically easier and more
compact in C because we can play destructively with extra-Prolog bits
and pieces of the representation.

Possibly this tells us that compiling dynamic clauses is easier in C
because we might have to deal with very large structures with huge
amounts of variables where space requirements for the variable
annotations becomes crucial and optimization is rather unimportant. On
the other hand, compiling static code might be better in Prolog because
optimization by recognising patterns is easier.

As far as I recall, my original motivation for SWI-Prolog was that the
compiler was simple anyway and that writing it in C would provide faster
assert and make bootstrapping the system easy.

Cheers --- Jan
0 new messages