|[4 earlier articles]|
|Re: Using Prolog to Compile Things email@example.com (1999-05-22)|
|Re: Using Prolog to Compile Things firstname.lastname@example.org (JT) (1999-05-22)|
|Re: Using Prolog to Compile Things Daniel.Diaz@inria.fr (1999-05-22)|
|Re: Using Prolog to Compile Things email@example.com (1999-05-27)|
|Re: Using Prolog to Compile Things firstname.lastname@example.org.OZ.AU (1999-05-27)|
|Re: Using Prolog to Compile Things email@example.com (1999-06-02)|
|Re: Using Prolog to Compile Things firstname.lastname@example.org (Nick Roberts) (1999-06-06)|
|Re: Using Prolog to Compile Things email@example.com (Laurent Guerby) (1999-06-12)|
|From:||"Nick Roberts" <firstname.lastname@example.org>|
|Date:||6 Jun 1999 23:01:11 -0400|
|References:||99-05-069 99-05-094 99-06-009|
First, I'd like to take this opportunity to thank very much all the
people who took the time and trouble to reply either to the group or
to me directly. Your responses were extremely helpful, and I am most
Second, I was actually seriously proposing that the compiler itself be
written in Prolog (rather than a compiler compiler). My long term
plan is, I think, to: (a) write a Prolog interpreter in Ada; (b) write
an optimising Ada compiler in Prolog; (c) recompile the Prolog
interpreter (to get a faster Prolog interpreter); (d) write a Prolog
compiler in Prolog, and compile the Ada compiler (thus getting a
faster Ada compiler); (e) convert the speed-critical parts (or maybe
all) of the Ada compiler into Ada (thus getting an even faster Ada
compiler). I think the technical term for this process is
'bootstrapping' (or is it 'incest'? :-)
It is certainly the case that I will use a great deal of (the Prolog
equivalent of) macro pre-processing to get from source code to running
(interpreted) Prolog code, but this is totally standard Prolog idiom.
A distinct possibility is the use of Prolog to seriously transform
things (e.g. BNFs to Prolog rules), perhaps over many, many steps, but
I haven't got to anything like this level of sophistication yet (and I
hope I can avoid it!).
My main ambitions in using Prolog are: (1) to investigate the
possibilities of searching deeply for optimal code; (2) to 'expose'
the inner workings of a compiler to students as much as possible, to
facilitate both understanding and experimentation. As such, speed of
execution necessarily has to take a back seat (at this stage, anyway).
On top of this, pundits tell me that a Prolog program can, with a
sophisticated compiler, be compiled into native code almost as fast as
if the program had been written in an imperative language. This
doesn't necessarily solve the problem of Prolog's (legendary) memory
greed, however, so it may or may not be a 'final solution.'
Real compilers tend to be obscure beasts, and therefore, I think, a
bit of a turn-off for many students of systems software.
I am fascinated by the idea of creating a compiler whose inner
workings can be much more readily 'seen' by students. I feel Prolog
can help to do this, in conjunction with the pedantic approach of
'first we do transformation A, then we do transformation B, then C,
then D, then E,' and so on. Incredibly slow, yes; but it would be
practicable (especially by the use of really good windowing
facilities) to show the results of each step, in a (reasonably)
readable form, all the way from source to object. I think a lot of
students would find that fun. It would be to compiler students what
'George' (the archetypal 'dummy' body) was to medical students.
Anyway, enough ramblings. Here's to the universe dying hot!
Mark William Hopkins wrote
|Actually, the entire question is being posed at the wrong level. It's
|not a compiler you want written in Prolog, but the program that
|generates the compiler! Because that's where the intelligence is
|Here, efficiency is irrelevant. It's not the efficiency of the
|process that counts, but of the product made by the process.
|[Well, it's not totally irrelevant. The process does have to finish
|before the heat death of the universe to be of practical interest. -John]
Return to the
Search the comp.compilers archives again.