users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: naive question about porting


From: Fergus Henderson
Subject: Re: naive question about porting
Date: Fri, 10 Jan 2003 02:10:41 +1100
User-agent: Mutt/1.3.28i

On 08-Jan-2003, Erick Alphonse <address@hidden> wrote:
> I'm taking advantage of the recent thread about porting to ask you some 
> questions about it:
> - What are the pros and cons of porting compared to writing a front-end 
> to a compiler like gcc?

Writing a Prolog front-end for GCC would be a fairly major piece of work.
It would be a lot harder than writing e.g. a Pascal front-end for GCC,
since GCC was designed for procedural/OO languages, but does not have
any direct support for logic programming languages.

You may be interested in the following paper:

        "Compiling Mercury to high-level C code",
        Fergus Henderson and Zoltan Somogyi.
        Proceedings of the 2002 International Conference on Compiler
        Construction Grenoble, France, April 2002. ? Springer-Verlag
        <http://www.mercury.cs.mu.oz.au/information/papers.html#hlc_cc>.

Using the technique described in this paper, I have written a GCC
front-end for Mercury.  However, this relies fairly heavily on
Mercury's type, mode, and determinism analysis.  If you were trying
to do the same thing for Prolog, it would be more complicated,
due to the need to handle Prolog's dynamic types and dynamic modes,
and it would probably also be a lot less efficient.

> - By writing a front-end to gcc, can one benefit from some optimisations 
> made by gcc? In other words, does gcc perform optimisation on its 
> "abstract machine code"?

Yes, it does.

-- 
Fergus Henderson <address@hidden>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]