F and G95 
Author Message
 F and G95

I have some questions about F (the fortran 95 subset) and G95.

The goal of the G95 project is to produce a full Fortran 95 (F95) open
source compiler. How much smaller a task would it be to create from
scratch an F compiler? The F language is much smaller than F95 (can
this be quantified?) and should also be easier to parse (no fixed
source form, for one thing). Once G95 is finished, it would be nice to
have compiler switches to restrict the language to Elf (from Lahey) or
F, if doing so does not violate copyrights.

I am aware that F compiler binaries can be downloaded free for many
platforms, and I am NOT claiming that the mission of G95 should have
been different.



Thu, 20 Jul 2006 02:17:51 GMT  
 F and G95

Quote:
> I have some questions about F (the Fortran 95 subset) and G95.

> The goal of the G95 project is to produce a full Fortran 95 (F95) open
> source compiler. How much smaller a task would it be to create from
> scratch an F compiler? The F language is much smaller than F95 (can
> this be quantified?) and should also be easier to parse (no fixed
> source form, for one thing). Once G95 is finished, it would be nice to
> have compiler switches to restrict the language to Elf (from Lahey) or
> F, if doing so does not violate copyrights.

There are actually two open source f95 projects on the go:

G95:  http://g95.sourceforge.net/

and

gfortran: http://gcc.gnu.org/fortran/index.html

it is a bit of a shame that there is two projects trying to accomplish the
same thing but when people a) with the ability to create a compiler... not
even close to a simple task and b) who are freely contributing their time
for the benefit of us all you can't really make them work together if they
don't want to now can you.

F is I believe a restricted version of NAG's full f95 compiler... so to
try to answer your question I don't think it would actually be that much
easier to make a compiler for say a subset of f95 like F than doing the
whole thing... at least not enough to justify not doing the whole
standard.  I'm no expert on writing compilers... I did have to write a
very simple one back in my undergrad days which was about the hardest
piece of code I have ever written so I suspect that my gut feeling is
close to truth.  Besides one of the most useful things about f95 is that
you can still use all that well tested f77 code without have to fiddle
around.  Most new code that I write compiles no problem with F... but I
use a whole lot of f77 code from netlib so using F is not an option.

Cheers,
Jason



Thu, 20 Jul 2006 06:38:00 GMT  
 F and G95

Quote:

>>I have some questions about F (the Fortran 95 subset) and G95.

>>The goal of the G95 project is to produce a full Fortran 95 (F95) open
>>source compiler. How much smaller a task would it be to create from
>>scratch an F compiler? The F language is much smaller than F95 (can
>>this be quantified?) and should also be easier to parse (no fixed
>>source form, for one thing). Once G95 is finished, it would be nice to
>>have compiler switches to restrict the language to Elf (from Lahey) or
>>F, if doing so does not violate copyrights.

> There are actually two open source f95 projects on the go:

> G95:   http://www.*-*-*.com/

> and

> gfortran: http://www.*-*-*.com/

> it is a bit of a shame that there is two projects trying to accomplish the
> same thing but when people a) with the ability to create a compiler... not
> even close to a simple task and b) who are freely contributing their time
> for the benefit of us all you can't really make them work together if they
> don't want to now can you.

> F is I believe a restricted version of NAG's full f95 compiler... so to
> try to answer your question I don't think it would actually be that much
> easier to make a compiler for say a subset of f95 like F than doing the
> whole thing...

First, I think it would be a fair bit easier, but that doesn't mean
it is a worthwhile thing to do. The one thing that I think would
be interesting would be to see how much more optimization could
be done without having to worry about the things not in F.

                    Besides one of the most useful things about f95 is that

Quote:
> you can still use all that well tested f77 code without have to fiddle
> around.  Most new code that I write compiles no problem with F... but I
> use a whole lot of f77 code from netlib so using F is not an option.

Second, since you need gcc to run F, you have f77 also.
So, using F certainly is an option in this situation.
I.e., f77 routines are callable from F, so you can
write new code in F (as you say you do) and use f77
to compile the F77 code. What you can't handle is
code written in full F90/95.

A switch on g95 to restrict things to the F subset
is certainly feasible (IIRC, it was promised when I
provided our Lite test suite to the g95 folks--but
maybe that has all been forgotten), but the motivation
is not great to use F when g95 is available. I think
probably the reason for the use of F is the cost, not
what it should be--enforcement of a more readable,
portable, modern set of constructs.

In summary, although it would be (IMO) considerably
easier to write an F compiler than a full f95 compiler,
I don't think there is enough advantage to it over the
free F compiler (even though not open source) that it
would be worth doing. I am even a little skeptical of
g95 gaining wide acceptance if it doesn't implement
every {*filter*}y extension ever invented by IBM, Cray, DEC,
etc.

But it would be great to be proved wrong!

--
Walt Brainerd         +1-877-355-6640 (voice & fax)
The Fortran Company   +1-520-760-1397 (outside USA)

Tucson, AZ 85750 USA   http://www.*-*-*.com/



Thu, 20 Jul 2006 11:28:04 GMT  
 F and G95

Quote:

> The F language is much smaller than F95 (can
> this be quantified?) and should also be easier to parse (no fixed
> source form, for one thing).

Fortran, including Fortran 95, is one of the easier languages to parse.
There is a bit of stickiness in the area of output lists, but that is
about it.  It is lexical analysis that proves hard, if you don't know
how to do it.  The fixed source form is a matter of lexical analysis,
not parsing.

The problems of lexical analysis are not particularly hard, but someone
who doesn't know the rules could have trouble figuring out which cases
need to be checked and how to check them.  The rules have been documented,
so it should no longer be an issue.  For example, the dragon book gives
a terse explanation of the rules in the chapter on lexical analysis.

If you want to find languages that are hard to parse, look at C and
especially C++.

                                                     Sincerely,
                                                     Bob Corbett



Thu, 20 Jul 2006 16:04:29 GMT  
 F and G95

Quote:

> I am even a little skeptical of
> g95 gaining wide acceptance if it doesn't implement
> every {*filter*}y extension ever invented by IBM, Cray, DEC,
> etc.

I suspect g95 could succeed if it didn't implement the double-quote
form of octal constants (e.g., "177) from DEC Fortran.  I will admit,
however, that Sun f95 now implements that form.  I fought hard against
adding it, but it got in anyway.  At least you have to give an option
on the command line to get them.

                                               Sincerely,
                                               Bob Corbett



Thu, 20 Jul 2006 16:12:49 GMT  
 F and G95

Quote:
> If you want to find languages that are hard to parse, look at C and
> especially C++.

and if a compuer (algorithm) finds it hard to parse, what about its
human users?

But that is a rethorical question, of course.

        Jan



Fri, 21 Jul 2006 17:21:14 GMT  
 F and G95

Quote:
> I have some questions about F (the Fortran 95 subset) and G95.

> The goal of the G95 project is to produce a full Fortran 95 (F95) open
> source compiler. How much smaller a task would it be to create from
> scratch an F compiler? The F language is much smaller than F95 (can
> this be quantified?) and should also be easier to parse (no fixed
> source form, for one thing). Once G95 is finished, it would be nice to
> have compiler switches to restrict the language to Elf (from Lahey) or
> F, if doing so does not violate copyrights.

> I am aware that F compiler binaries can be downloaded free for many
> platforms, and I am NOT claiming that the mission of G95 should have
> been different.

  There is a (non-functional) switch in g95 for parsing F programs.  
Producing an F compiler from an f95 compiler amounts to mainly disabling
various constructs, so it made more sense to implement f95 first.  I still
have Walt's test code laying around, though I haven't tried it out.

     Andy

----------

http://www.g95.org



Sat, 22 Jul 2006 03:35:46 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. g95 on Windows: g95.exe: no input files

2. G95 Funding (Chicken or Egg)

3. G95 is OK to *learn* Fortran?

4. Data Plotting Library DISLIN for G95/Linux

5. xlf / nag / ifort / pgf90 vs g95 / sun f90 / ifc 7.1

6. Code update for g95

7. new gcc-g95 binaries released

8. g95 status

9. linking g95-built library from VC++

10. automatic arrays with negative size in g95 and gfortran

11. g95 gotoBLAS test failed

12. Common statement does not work with gfortran, but g95 gives the correct answer

 

 
Powered by phpBB® Forum Software