Re: Compilers and using gcc as part of the compiler

fjh@cs.mu.OZ.AU (Fergus Henderson)
16 Aug 2001 23:56:39 -0400

          From comp.compilers

Related articles
Compilers and using gcc as part of the compiler nicholas.king@studentmail.newcastle.edu.au (Nicholas King) (2001-08-15)
Re: Compilers and using gcc as part of the compiler fjh@cs.mu.OZ.AU (2001-08-16)
Re: Compilers and using gcc as part of the compiler axel@dtone.org (Axel Kittenberger) (2001-08-17)
Re: Compilers and using gcc as part of the compiler joachim_d@gmx.de (Joachim Durchholz) (2001-08-18)
| List of all articles for this month |
From: fjh@cs.mu.OZ.AU (Fergus Henderson)
Newsgroups: comp.compilers
Date: 16 Aug 2001 23:56:39 -0400
Organization: Computer Science, University of Melbourne
References: 01-08-071
Keywords: GCC
Posted-Date: 16 Aug 2001 23:56:39 EDT

Nicholas King <nicholas.king@studentmail.newcastle.edu.au> writes:


>I am working on building a compiler for a object oriented language i have
>designed that consists of allowing methods in a object to return multiple
>types at once.
>ie return (String ,Int)
>Now i was thinking would it be possible to use the gcc backend as the code
>generation phrase? But i am unable to find anything on gcc architecture.
>Any help would be appreciated.
>Yours Sincerely Zeddie
>[I'd compile to C and then use GCC to compile the C code. -John]


The moderator's advice is good. Even if you do decide to implement
your own compiler and interface to the back-end, your compiler will be
much easier to debug if you first generate C code, and only try
interfacing directly with the GCC back-end once the C code works. But
you should also consider compiling to C++ or Java if they are a better
match for your source language.


Alternatively, rather than writing a new compiler, just modify the
compiler for an existing language to support your new extensions.
This is likely to be a lot easier than writing a compiler from
scratch. There are many freely available open-source compilers
around.


If you do want more information on how to interface with the GCC
back-end, see the chapter "Writing a compiler front-end" in "Using,
Maintaining and Enhancing COBOL for the GNU Compiler Collection (GCC)"
<http://cobolforgcc.sourceforge.net/cobol_toc.html>; the documentation
on the tree intermediate representation
<http://gcc.gnu.org/onlinedocs/gcc.html>; and the "example" and "toy"
sample front-ends which are linked to from
<http://gcc.gnu.org/readings.html>.
--
Fergus Henderson <fjh@cs.mu.oz.au> | "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.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.