Historical Perspective: FORTRAN I
The first version of FORTRAN violates many notions of good
programming language (PL) design. Here are some highlights:
- Variables can be upto 5 chars long and must begin with a letter.
Variables beginning with i, j, k, l, m and n are assumed to be integer
types. Some PL experts say this is why the letters i and j are so
popular even now as loop variable names.
- Variable declarations are not required, except for arrays.
Arrays are limited to 3 dimensions.
- The control structures consisted of:
- unconditional branch: GOTO statement_number
- conditional branch:
GOTO (30, 40, 50) I1 where
has a value of 1, 2 or 3 to indicate which position in the list to jump
- IF statement:
IF (A+B-1.2) 7, 6, 9 transfers
control to statement labeled 7, 6, or 9 depending on whether
is negative, zero or positive.
- DO statement:
DO 17 I = 1, N, 2 which specifies
that the set of statements following, up to and including that labeled
17, is to be executed with I first assigned value 1, incrementing
by 2, up through N.
- No user-defined subroutines allowed, although several built-ins
were provided including
- Blanks are ignored in all statements, e.g., all the following are
- DIMENSION IN DATA(10000)
- D I M E N S I O N I N D A T A ( 1 0 0 0 0 )
- Whitespace was relevant in other cases: Code started on a
particular column number.
- Reserved words are valid variable names, e.g.,
IF(100) declares an array called IF.
- FORTRAN had two basic stages in compiling:
- Lexical analysis, parsing, and code generation in one big loop
and switch program.
- The other stages of the compiler were dealing with code