On Sun, 2021-06-20 at 23:06 -0700, Chuck Guzis via cctalk wrote:
Some may find this paper interesting on the FORTRAN I
compiler:
https://www.cs.fsu.edu/~lacher/courses/COT4401/notes/cise_v2_i1/fortran.pdf
I will add that the diagnostic error messages for FORTRAN I were
prettygood for the time. Missing a comma in a computed GOTO? There
was anerror message that directly addressed this error.
Back when I was still in the business of writing compilers, the
"DragonBook" ("Compilers: Principles, Techniques and Tools", Aho,
Sethi;Ullman) was the standard reference. I don't know if it still
is. Theearlier book by Saul Rosen is also pretty good.
FORTRAN (as opposed to Fortran) is somewhat odd lexically when
comparedwith other languages. There are no reserved words, there is
no conceptof whitespace (except in Hollerith constants) and
combinations ofEQUIVALENCE and COMMON have sent many a compiler
designer to tipple.
You also might like
https://www.cs.sjsu.edu/~mak/CMPE152/IBM1401FORTRANCompiler.pdf "Serial
Compilation and the IBM 1401 FORTRAN Compiler."
1401-FO-050 was more than FORTRAN I but less than FORTRAN II.
The innovation was interesting. The first overlay read the program into
core. The next 62 gradually massaged it into executabe form. No
auxiliary storage -- tape or disk -- was used. The compiler would run
from cards (a bit more than one full box) or tape.
There's a video of
it running at CHM on
https://www.youtube.com/watch?v=uFQ3sajIdaM.
Fortran 2020 is rather different from FORTRAN I. There are still no
reserved words, but blanks are significant so you can't put them within
a variable, constant, keyword, or operator. But a blank is optional
within some keywords, such as ENDIF is allowed instead of END IF. It's
also a modern language. FORTRAN 77 was criticized for not providing
dynamic memory and structured data types. Those were included in
Fortran 90, along with modules,explicit interfaces, significant blanks,
free-form input.... Fortran 2003 added object-oriented programming,
based on the SIMULA model, C interoperability, .... Fortran 2008 added
a much simpler SPMD parallel programming model, called coarrays -- much
easier to use than PVM or MPI.
But there are lots of ways to skin the proverbial cat.
When I had
toproduce an extended BASIC compiler for the 8085 using only a
floppy-diskMDS 800 system, I adopted a technique I learned from an
old IBM COMTRANcompiler guru. Lay out the semantics of your
compiler; lexicalelements, their characteristics, etc. and then think
of them as tokensfor a hypothetical machine that takes as input
lexical elements andproduces some sort of code as output. Initially,
my exposure to thistechnique was in a COBOL dialect translator--you
took more or lessstandard COBOL as input and produced bastardized
COBOL as output.
You design the instruction set of your hypothetical machine, then
eitherinterpret it or use those instructions to produce macro
calls. ASM80 onISIS II had a relatively weak macro facility, so we
wrote the macroprocessor in PL/M. Worked like a charm--in 4 months
we had a workingcompiler. I still have the design paper that I wrote
for it.
For whatever an old man's story is worth...
--Chuck