Fortran compiler for mac to read program

146 Views Asked by At

I'm using the g77 compiler (on terminal I just type g77 filename.for ) on a Mac. It can't read my fortran program and I can't modify the program (very old program, not mine, and I really just need the output from it). Any suggestion for another compiler to read the program?

Here is the kind of error I get:

android-ae71922e0bc4a747:~ jadecheclair$ g77 geomalb.for 
geomalb.for: In program `geometric':
geomalb.for:61: 
         accept *,fhaze
         1      2
Unrecognized statement name at (1) and invalid form for assignment or statement-function definition at (2)
1

There are 1 best solutions below

1
On BEST ANSWER

The ACCEPT statement is not part of Fotran standard. It is a non-standard extension and therefore your program is not a FORTRAN 77 program and you cannot expect all compilers to compile it.

Notably, g77 does not support this extension https://gcc.gnu.org/onlinedocs/g77/TYPE-and-ACCEPT-I_002fO-Statements.html The modern successor of g77 - gfortran - does not support it either.

You can try the Intel compiler (costs money), Oracle compiler (free for Linux, not available for Mac) or (much better) convert the source code to Fortran by changing the ACCEPT to READ.