What is it?
Fortran is a compiled programming language, originally developed by John Backus at IBM in 1949. It's the oldest computer language and, amazingly, it is still in use today. Fortran is a very formal imperative language, not permitting direct iteration and allowing subroutines. The name FORTRAN is a contraction for "Formula Translator". Fortran provides a robust imperative scientific programming language that is still used by engineers and scientists, mainly because of the existence of a large base of quality legacy code. However, Fortran bears its age, and many scientists now use Matlab, Maple or functioanl languages as their main programming language for new developments. Fortran standards have fluctuated over the years, today some people still use the FORTRAN 77 standard created way back in 1978 although the language has gone through major revampings in 1990 and 1995, and the next evolution of the standard was due to be released in 2003. No Fortran 2003 compilers are availible yet.
Good Points
Fortran provides very efficient code, especially when it comes to large numerical computations on vectors and matrices, compiled Fortran can be faster than compiled C code. Because of its very simple syntax, good optimizing Fortran compilers are easier to produce than good C compilers.
- Tightly compiled code
- very good scientific libraries available, like LAPACK.
Bad Points
Fortran is the oldest computer language around, and its older versions, FORTRAN 66 and FORTRAN 77 feel like it: they are considered hard to program and hard to debug. There was very little support for data structures, far less than C for example. The language expressiveness in FORTRAN 66 was minimalist. However, Fortran 95 is a fast modern language, although its popularity is probably not yet as large as for the old Fortran 77, perhaps because most legacy code is written in F77. Fortran 95 compilers are now quite suitable for realistic scientific research and there are excellent reasons to move from Fortran 77 to 95, such as the availability of modules, and allocatable arrays, and other new features.
Due to the demonization of Fortran by some programmers, intrinsic libraries and good compilers remain commercial rather than Open Source.
- Bindings for a small number of GNU libraries only
- No Open Source GUI bindings as yet, and only a few commercial ones
Fortran 77 has a now outdated syntax, designed for punched cards -- not so with Fortran 95
- Only a few free or Open Source compilers availible, but new ones are on the way
Critical Software
In all there are several Open Source or free fortran compilers, Open Watcom and the GNU compilers, g77, g95, and gfortran. OpenWatcom is an Open Source release of the Watcom (Sybase) compiler suite and g77 is the GNU Fortran compiler bundled with gcc. Amongst the Commercial Compilers, Microsoft Fortran Powerstation 4.0 (which has been discontinued for some time now) and Fijutsu Fortran 95 are the most widely used; however Lahey Fortran and Salford are preffered by some.
Compilers
There are a number of Open Source compilers for Fortran, however the most standard compliant compiler is GNU Fortran g77 and g95 projects which are availible from http://gcc.gnu.org.
Examples
Hello World Program
PROGRAM HELLO
WRITE(UNIT=*, FMT=*) 'Hello, world'
END STDIN program
PROGRAM STDIN
CHARACTER*100 TEST
DO WHILE(TEST.NE."END")
READ*,TEST
PRINT*,TEST
ENDDO
END ASCII Table
program ASCII_Table
integer i
do i=32,127
print '($I3,3H = ,A1,1H )', i,CHAR(i)
enddo
stop
endRandom Numbers
program Random_Numbers
real r
!Initializes random numbers generator
r = RAND(TIME())
r = RAND(0)
print *,r
stop
end
Resources
Some resources, just blasting them at you, see what you find!
F Programming Language (F is a subset of Fortran 90, and the compilers are free.)
