FORTRAN I as --std=1¶
Form C28-6003, October 1958, is a minor revision of 32-7026-1. It describes
the FORTRAN I language. It is not the FORTRAN II manual. This note records
the reading used by --std=1. The manual is not in this tree.
The preview “of the Fortran Statements” says there are 32 types: one arithmetic formula, 15 control statements, 13 input-output statements, and 3 specification statements.
Chapter 3 defines a function statement, name(...) = expression. That is
an arithmetic statement function. It is not a FUNCTION subprogram.
--std=1 and --std=2 accept it. The name is 4 to 7 characters ending
in F, and the value is fixed-point exactly when the name begins with X.
The expression must not use a subscripted variable. A variable must not
repeat a function used in that program with the terminal F removed.
Under --std=1 and --std=2, a subscript exclusive of its addend must
lie in the dimension. --std=0 rejects the function statement, because the
1954 report does not define the form, and it does not split a subscript
addend. --std=1 does not treat the function statement
as absent from the language.
Chapter 4’s 15 control statements are the unconditional, assigned, and
computed GO TO, ASSIGN, the arithmetic IF, SENSE LIGHT,
IF (SENSE LIGHT), IF (SENSE SWITCH), IF ACCUMULATOR OVERFLOW,
IF QUOTIENT OVERFLOW, IF DIVIDE CHECK, PAUSE, STOP, DO, and
CONTINUE. Chapter 5’s 13 input-output statements are READ, PUNCH,
PRINT, READ INPUT TAPE, WRITE OUTPUT TAPE, FORMAT, READ TAPE,
READ DRUM, WRITE TAPE, WRITE DRUM, END FILE, REWIND, and
BACKSPACE. A bare array name in an input or output list is transmitted
in the inverse of its natural order. C28-6003 printed page 26 says so,
and printed page 34 says the same for READ DRUM. --std=2 uses that
order too. A bare WRITE is not one of those 13. The error is
“a bare WRITE is not a FORTRAN statement”. An assigned GO TO inside a
DO follows the 1956 printed page 22 restriction, the same rule as
--std=2. C28-6003 printed page 23 requires the first statement of a
DO range to be executable. The diagnostic is “the first statement of
a DO must be executable”, the same rule as --std=2. COMMON is
still “COMMON is not in FORTRAN I” before that check. Chapter 6’s three
specification statements are DIMENSION,
EQUIVALENCE, and FREQUENCY.
Chapter 7, printed pages 49–50, says the following tables apply exclusively
to Fortran II: the SUBDEF table (arguments of SUBROUTINE and FUNCTION),
the COMMON table, and the HOLARG table (Hollerith arguments of CALL).
--std=1 therefore rejects SUBROUTINE, a FUNCTION subprogram, CALL,
RETURN, COMMON, and END(i1,i2,i3,i4,i5). The error names the
statement and says it is not in FORTRAN I. RETURN and the five END
switches are the other two statements C28-6000-2 adds; C28-6003 does not
describe them.
A bare END is still accepted. C28-6003 ends a source tape with an
end-of-file mark and does not list END among the 32 statements. This
driver reads a file of cards, and a bare END is how it closes the one
program unit. The parenthesised form is the one that is rejected.
--std=1 enforces the numeric limits on C28-6003 printed pages 49-50,
tables 1-22. The bound is allowed. Tables 23-27 stay FORTRAN II only
and are not applied. The names and bounds are TEIFNO 1500, FIXCON 100,
FLOCON 450, TDO 150, a nest of 50 DO statements, TIFGO 300, TRAD 250,
FRET 750, DIM 100, 100, and 90, EQUIT 750, FORMAT 715, LAMBDA 400,
BETA 300, ALPHA, CLOSUB 1500, FORVAL 500, FORVAR 750, FORTAG 1500,
TAU 100, 90, and 75, SIGMA 99, FORSUB 50, and NLIST 25.
A labeled input or output list statement that contains an implied DO counts twice toward TEIFNO. A numbered DIMENSION, EQUIVALENCE, or statement function counts as well, although that statement is not kept. A blank does not split a number in FREQUENCY. TDO counts DO statements and each implied DO. The nest limit counts DO statements whose ranges contain one another, not implied DOs. A nest of 50 compiles. The runtime DO stack holds 40, so executing that nest reports “DO nested too deeply”. A nest of 51 is “DO nest exceeds 50”.
LAMBDA is n+4b+4a−3f+3p+2t+e+3 for one arithmetic right-hand side, one statement-function body, or one arithmetic-IF argument. BETA is λ+1−n−f and applies to the same expressions. ALPHA walks arithmetic statements only. The parenthesis counter starts at 3 and moves by 4 at each parenthesis, including subscripts. The selected ceiling is the printed 8K figure, 139. The printed 4K figure is 43 and is not selected. There is no 4K switch.
TAU follows the ordered sets on printed page 45. A one-subscript combination is c, v. Two subscripts add the first dimension and omit the last. Three subscripts add the first two dimensions and omit the last. SIGMA counts additive parts in full form when at least one is not zero, 99 for each rank.
FORSUB’s printed limit of 50 is checked. The compiler rejects the 33rd
statement function before that check. EQUIT’s printed limit of 750 is
checked. A group holds at most 8 names and there are at most 32
groups, so that check is not reached. --std=2 and --std=0 do not
apply tables 1-22. C28-6000-2 prints no replacement ceilings for them.
Tables 23-27 on the same printed page are FORTRAN II only. They are
applied under --std=2 and are described in dialect/fortran2.md.
A FORTRAN I program in this subset compiles under --std=2 while it
stays inside those tables. Three hundred and one STOP statements
compile under --std=1 and exceed TSTOPS under --std=2.
Chapter 7’s three-subscript skeletons, printed pages 46 and 47, are
sufficient conditions. A list they exclude still compiles. The
restriction on variable indexing parameters and relative constants,
at the top of printed page 47, applies to READ TAPE and
WRITE TAPE under --std=1. The relative-constant definition rules
on printed pages 47 and 48 apply to READ TAPE, READ DRUM, READ,
and READ INPUT TAPE under --std=1. --std=2 does not apply either
rule. The reading is in dialect/fortran2.md.
FORTRAN I-specific diagnostics and table limits use local regression
expectations. Shared language behaviour also has exact comparisons with
original FORTRAN II captures, described in the corpus guide.