Fortran is a programming language created in 1957 by John Backus.

#51on PLDB | 67Years Old | 29kRepos |

Fortran (; formerly FORTRAN, derived from Formula Translation) is a general-purpose, imperative programming language that is especially suited to numeric computation and scientific computing. Originally developed by IBM in the 1950s for scientific and engineering applications, Fortran came to dominate this area of programming early on and has been in continuous use for over half a century in computationally intensive areas such as numerical weather prediction, finite element analysis, computational fluid dynamics, computational physics, crystallography and computational chemistry. It is a popular language for high-performance computing and is used for programs that benchmark and rank the world's fastest supercomputers. Read more on Wikipedia...

- Tags: programming language, physics, chemistry, biology
- There are at least 29,127 Fortran repos on GitHub
- Early development of Fortran happened in IBM
- The Google BigQuery Public Dataset GitHub snapshot shows 2k users using Fortran in 3k repos on GitHub
- There are 6,269 members in the Fortran subreddit
- There are 464 Project Euler users using Fortran
- Explore Fortran snippets on Rosetta Code
- Fortran is supported by the GDB
- Fortran on HOPL
- Fortran ranks #32 in the TIOBE Index
- ANTLR grammar for Fortran
- Fortran LSP implementation
- CodeMirror package for syntax highlighting Fortran
- Pygments supports syntax highlighting for Fortran
- GitHub supports syntax highlighting for Fortran
- Learn Fortran on exercism.
- There is 1 Jupyter Kernel for Fortran
- Indeed.com has 447 matches for "fortran engineer".
- See also: (23 related languages) Speedcoding, ALGOL 58, BASIC, C, Chapel, CMS-2, PL/I, PACT I, MUMPS, RATFOR, Assembly language, Laning and Zierler system, IBM 1620, UCSD Pascal, WATFIV, ASCII, Modula-2, Ada, Mortran, Ratfiv, JCL, SIMSCRIPT, F
- Read more about Fortran on the web: 1.
- 5 PLDB concepts link to Fortran: BALGOL, EXPLOR, GCC, ICETRAN, Particles

Example from Compiler Explorer:

```
! Type your code here, or load an example.
real function square(x)
implicit none
real, intent(in) :: x
square = x * x
return
end function square
```

Example from Riju:

```
PROGRAM hello
PRINT *, "Hello, world!"
END PROGRAM hello
```

Example from hello-world:

```
print *,'Hello World'
end
```

Example from the Hello World Collection:

```
C Hello World in Fortran
PROGRAM HELLO
WRITE (*,100)
STOP
100 FORMAT (' Hello World! ' /)
END
```

Example from Linguist:

```
! Codes/HYCOM/hycom/ATLb2.00/src_2.0.01_22_one/
real onemu, twomu
data onemu/0.0098/
data twomu/1./
data threemu/0.e9/
end
```

Example from Wikipedia:

```
program average
! Read in some numbers and take the average
! As written, if there are no data points, an average of zero is returned
! While this may not be desired behavior, it keeps this example simple
implicit none
real, dimension(:), allocatable :: points
integer :: number_of_points
real :: average_points=0., positive_average=0., negative_average=0.
write (*,*) "Input number of points to average:"
read (*,*) number_of_points
allocate (points(number_of_points))
write (*,*) "Enter the points to average:"
read (*,*) points
! Take the average by summing points and dividing by number_of_points
if (number_of_points > 0) average_points = sum(points) / number_of_points
! Now form average over positive and negative points only
if (count(points > 0.) > 0) then
positive_average = sum(points, points > 0.) / count(points > 0.)
end if
if (count(points < 0.) > 0) then
negative_average = sum(points, points < 0.) / count(points < 0.)
end if
deallocate (points)
! Print result to terminal
write (*,'(a,g12.4)') 'Average = ', average_points
write (*,'(a,g12.4)') 'Average of positive points = ', positive_average
write (*,'(a,g12.4)') 'Average of negative points = ', negative_average
end program average
```

Fortran Keywords

`ACCESS ACTION ADVANCE ALLOCATABLE ALLOCATE ASSIGN ASSIGNMENT BACKSPACE BLANK BLOCK CALL CASE CHARACTER CLOSE COMMON COMPLEX CONTAINS CONTINUE CYCLE DATA DEALLOCATE DEFAULT DELIM DIMENSION DIRECT DO DOUBLE ELSE ELSEWHERE END ENDFILE ENTRY EOR EQUIVALENCE ERR EXIST EXIT EXTERNAL FILE FMT FORM FORMAT FORMATTED FUNCTION GO IF IMPLICIT IN INOUT INQUIRE INTEGER INTENT INTERFACE INTRINSIC IOLENGTH 10STAT KIND LEN LOGICAL MODULE NAME NAMED NAMELIST NEXTREC NML NONE NULLIFY NUMBER ONLY OPEN OPENED OPERATOR OPTIONAL OUT PAD PARAMETER PAUSE POINTER POSITION PRECISION PRINT PRIVATE PROCEDURE PROGRAM PUBLIC READ READWRITE REAL REC RECl RECURSIVE RESULT RETURN REWIND SAVE SELECT SEQUENCE SEQUENTIAL SIZE STAT STATUS STOP SUBROUTINE TARGET THEN TO TYPE UNFORMATTED UNIT USE WHERE WHILE WRITE`

Feature | Supported | Example | Token |
---|---|---|---|

Scientific Notation | ✓ | ||

Strings | ✓ | 'Hello world' | ' |

Assignment | ✓ | = | |

Line Comments | ✓ | C A comment | ! |

Module Pattern | ✓ | module constants implicit none real, parameter :: pi = 3.1415926536 real, parameter :: e = 2.7182818285 contains subroutine show_consts() print*, "Pi = ", pi print*, "e = ", e end subroutine show_consts end module constants program module_example use constants implicit none real :: x, ePowerx, area, radius x = 2.0 radius = 7.0 ePowerx = e ** x area = pi * radius**2 call show_consts() print*, "e raised to the power of 2.0 = ", ePowerx print*, "Area of a circle with radius 7.0 = ", area end program module_exampl | |

Print() Debugging | ✓ | C Hello World in Fortran PROGRAM HELLO WRITE (*,100) STOP 100 FORMAT (' Hello World! ' /) END | |

Case Insensitive Identifiers | ✓ | x = 2.0 y = x + X | |

Comments | ✓ | C C Lines that begin with 'C' (in the first or 'comment' column) are comments C | |

Fixed Point Numbers | X | ||

Case Sensitivity | X | ||

Semantic Indentation | X | ||

Zero-based numbering | X | ||

MultiLine Comments | X | ||

hasReservedWords | X | C Keywords are specifically NOT reserved words. http://fortranwiki.org/fortran/show/Keywords. http://rsusu1.rnd.runnet.ru/develop/fortran/prof77/node46.html |