[LLVMdev] Google SOC - Idea

Jeff Cohen jeffc at jolt-lang.org
Tue Mar 20 09:50:16 PDT 2007


Kenneth Hoste wrote:
>
> On 20 Mar 2007, at 15:45, Jeff Cohen wrote:
>
>> Duncan Sands wrote:
>>>> If that fails, I will build a front-end using ANTLR 
>>>> [http://antlr.org] a parser generator with which I am familiar and 
>>>> for which a FORTRAN grammar is already available (targeting an 
>>>> obsolete version of ANTLR, but it should not be too difficult to 
>>>> update).
>>> Bad plan. I doubt you can build a serious fortran compiler in this 
>>> way in the time-frame you are considering.
>>
>> I agree.  I used to work on  Fortran compiler long, long ago in a 
>> former life.  There is no way you're going to write a usable 
>> front-end from scratch in a few months, even with the head start of a 
>> parser.  The parser is the easy bit.
>
> I don't think he's saying he'll build that Fortran front-end from 
> scratch, but will use an ANTLR-based parser for the front-end if the 
> GCC parser causes problems.. Or am I mistaking?

A parser only handles syntax.  Most of a front-end deals with 
semantics.  The GCC front-end does both syntax and semantics.  The only 
ANTLR grammar I could find for FORTRAN does syntax only; it produces 
just an AST.  It also only handles FORTRAN 77, which is very out of 
date.  It didn't even have vector expressions, which were added in 
FORTRAN 90 and present in at least one commercial compiler in the late 
eighties.

To be honest, I'm not sure he realizes what he's getting himself into.




More information about the llvm-dev mailing list