On 21 Mar 2007 at 20:39, Roger Holmes wrote:
100 FORMAT(
HX)=(1+BX )
Recall, that prior to FORTRAN 90, FORTRAN had no reserved words.
Yes that does look weird at first sight.
The bigger problem is that it's absolutely ambiguous in the light of
CDC FTN syntax. It can legitimately mean either a FORMAT statement
with the Hollerith constant ")=)1+B" or an assignment to the HX-th
element of an array called FORMAT of the value obtained by evaluating
1+BX. The PTR ended up on the "deferred" list for quite a long time
as no one could think of an adequately airtight fix. Lots of work-
arounds were proposed, such as "well, if the statement number is
referenced in an I/O statement, then it's a FORMAT" or "if there's an
array called FORMAT, then it's an assignment". Unfortunately,
FORTRAN doesn't demand that FORMAT statements be referenced by an I/O
statement--"orphans" are perfectly legal. It was a real puzzle.
Smart*ss customers!
The usual way for FORTRAN compilers to work back then was to look at
the first word of a statement and attempt to parse it accordingly.
If that failed, then the statement was deemed to be an expression and
re-parsed.
This is only one case where a vendor's language extension got it into
trouble. Early on, most language standard specifications called out
the minimum subset of the language that had to be implemented and
remained silent on vendor extensions. Hence, you got scads of
differing dialects all claiming to be "FORTRAN IV". To my knowledge,
this persists in BASIC more than in any other language, ANSI X3.113
nothwithstanding.
Cheers,
Chuck