Will tree-ssa be GCC 3.5?

Steven Bosscher s.bosscher@student.tudelft.nl
Mon Dec 1 18:14:00 GMT 2003


On Monday 01 December 2003 18:07, Ian Lance Taylor wrote:
> To me, even the goal of using the gfortran frontend with a non-free
> backend sounds misguided.  To me, it sounds simpler to just write a
> new frontend.  I mean, we're talking about FORTRAN here, not C++;

Exactly.  And how many good Fortran front ends are out there for recent 
Fortran standards?  Exacly one.  That's at least one less than C++ front ends 
I know of.

(The available Fortran front end is of course the excelent Cray Fortran 90 
front end which is a fine piece of software with a GPL v2.0 license and an 
SGI copyright, hence "not free enough" for the FSF, but "free enough" for 
everybody else.)

> I would expect that all the interesting stuff in FORTRAN would come in
> the middle and back ends.  But I say this without actually looking at
> the gfortran frontend.

You are very misguided here :-)  Fortran is an _insane_ language.   Writing a 
Fortran front end is probably the hardest part of writing a Fortran compiler, 
especially for Fortran 77, but also for more recent dialects. 

First of all, Fortran does not have a proper grammar (not LL, not LR, and not 
even GLR apparently).  Second, it does not have reserved keywords, so your 
parser and scanner end up interacting all the time and disambiguating 
keywords/identifiers/operators is sometimes difficult.  Third, you need to 
read ahead whole statements even before you can lex/parse them.  Finally, 
Fortran doesn't know all symbols while parsing because they don't have to be 
predeclared.

Hence, typical Fortran "parsers" have in fact four tightly coupled passes: 
prelexing, lexing, parsing and name/type resolution.  Fun, I assure you.

Later Fortran dialects have constructs for which efficient code generation is 
non-obvious and poorly described in the literature, but as you say, that's in 
the middle end.

But of course, this is even more off-topic than the rest of this thread :-)

Gr.
Steven



More information about the Gcc mailing list