Adding other languages to GCC (was, using GCC for back-end)

rms@gnu.ai.mit.edu (Richard Stallman)]
Thu, 4 Feb 1993 21:25:56 GMT

          From comp.compilers

Related articles
GCC as back-end summary davids@ICSI.Berkeley.EDU (1993-01-29)
Adding other languages to GCC (was, using GCC for back-end) rms@gnu.ai.mit.edu] (1993-02-04)
Re: Adding other languages to GCC (was, using GCC for back-end) moss@cs.cmu.edu (1993-02-05)
re: Adding other languages to GCC David.Chase@Eng.Sun.COM (1993-02-05)
Re: Adding other languages to GCC (was, using GCC for back-end) burley@apple-gunkies.gnu.ai.mit.edu (1993-02-08)
| List of all articles for this month |
Newsgroups: comp.compilers
From: rms@gnu.ai.mit.edu (Richard Stallman)]
Posted-By: davids@ICSI.Berkeley.EDU (David Petrie Stoutamire)
Keywords: GCC
Organization: International Computer Science Institute, Berkeley, CA, U.S.A.
References: 93-02-011
Date: Thu, 4 Feb 1993 21:25:56 GMT

The right way to add a new language front end to GCC is to make it
generate the not-quite-syntax-tree data structure defined in tree.h. That
is the input to the language-independent part of GCC. You should not try
to make RTL directly.


To do this, you must understand that part of GCC. But if you can write a
compiler, you can do that.


For a front end to generate RTL is undesirable because it is unmodular.
How to generate RTL depends on the target machine in complex ways. You
should leave that to the code which already does it. The tree data
structure is machine-independent aside from a few storage layout
parameters.


The idea of reading this RTL from a file is even worse. First, the RTL
chain is not the only information that the compiler needs. So this is far
from the simple task you might imagine. But even if you did make it work,
reading the RTL woulkd be very slow. It is just dumb to make the parser
communicate with the rest of the compiler by passing text through a file.


The right solution is to put the parser in the same process as the rest of
the compiler, and make it generate trees. This is what the front ends for
Pascal, Fortran, and Ada do.


There is no good documentation for the tree data structure. If someone
wants to write documentation and give it to the FSF, that would be useful.
--


Post a followup to this message

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