Introduction
FORTRAN, “the infantile disorder”, by now nearly 20 years old, is hopelessly inadequate for whatever computer application you have in mind today: it is too clumsy, too risky, and too expensive to use.
— Edsger W. Dijkstra, SIGPLAN Notices, Volume 17, Number 5 (1982)
FORTRAN, short for “FORmula TRANslation”, was the first high-level programming language and has been in wide-spread usage for decades. The first version was developed under the guidance of John Backus at IBM. Released in 1957 for the IBM 704, the language quickly gained popularity among scientists and engineers.
- Fig. 1: An 80-column punched card with Fortran code (source)
Many of the flaws which make Fortran an unloved child today have been deprecaded a long time ago and are not part of modern language versions anymore, such as:
- The obscure code indention by today’s standards, with reserved areas for statement labels and indentification fields, caused by the fixed form of Hollerith punch cards (see fig. 1).
- The infamous
goto
statement. - Arithmetic if conditions. Logical if was introduced in FORTRAN IV, block if in FORTRAN 77.
- Variables with implicit naming scheme, where the first letter of a variable name defines the data type, and the length of a variable name is limited to six characters.
- All uppercase syntax.
The latest Fortran standards 2003, 2008, and 2018 are major extensions of the language that make programming much more easy and fun. Modern features like object-oriented programming, inheritance, polymorphism, parallel processing, and interoperability with the C programming language have been added.
Fortran is sometimes seen as a Domain-Specific Language (DSL), as it is heavily used in numeric computation and high performance computing (HPC), especially in:
- climate research & numerical weather prediction,
- finite element analysis,
- trajectory optimisation,
- computational science (chemistry, biology, physics).
But the language is not limited to these areas. Fortran can be used as a General-Purpose Language (GPL), albeit with some constraints.
This chrestomathy tries to give an introduction to programming in modern Fortran on Unix-like operating systems. The example code has been tested on FreeBSD, using GNU Fortran and/or Flang, but should be at least partially compatible to other operating systems and compilers as well.
Several books dealing with modern Fortran are available. The e-book Introduction to Programming using Fortran 95/2003/2008 by Ed Jorgensen gives a first introduction, and can be downloaded for free. A general overview of online courses is listed in the learning section of Fortran-Lang.org.
< Index | [Index] | Fortran Compilers > |