IBM's 63-pass Fortran compiler

Seen in a discussion on writing compilers, a reference to IBM’s Fortran for the 1401, which compiled in a series of 63 phases, each making a simple transformation and everything running within 8000 characters of core memory (6-bit characters). Here’s the paper:

Serial compilation and the 1401 FORTRAN compiler by L. H. Haines

This paper discusses a compiler organization in which phases act sequentially on a source program held in core storage.

A brief description of each phase of the 1401 FORTRAN compiler is given to illustrate the general scheme.

The 1401 FORTRAN compiler has 63 phases, an average of 150 instructions per phase, and a maximum of 300 instructions in any phase.

Of course, a different example which immediately comes to mind is the single-pass Turbo Pascal compiler for the PC, which was tiny by today’s standards:

a full Pascal compiler, including extensions that it made it practical for commercial use, tightly integrated with an editor. And the whole thing was lightning fast, orders of magnitude faster at building projects than Microsoft’s compilers. The entire Turbo Pascal 3.02 executable–the compiler and IDE–was 39,731 bytes.

Also notable, from 1983, ACTION! was a single-pass compiler for the 6502-based Atari 8-bit machines. It’s Algol-like, and the implementation is apparently very hairy:

the source code is tremendously complicated by the amount of codesize optimization taking place, and discussion in the AtariAge forums from the folks who got it released indicates that writing this compiler pushed the author to his very limits

Another nearby comment:

I first encountered a many-many pass compiler when working on the IBM 1800 (same architecture as the IBM 1130) where the Fortran II compiler had 29 passes. It was challenging, as the machines often had only 4k and the removable cartridge disks were 5 megs.

2 Likes

This was particularly interesting to me because of my interest in small-memory (4-8 KiB) systems. Thanks for the reference!

The source program is stored backwards in order to use the 1401 machine instructions that cause address registers to decrement when processing data.

Shades of my life as a 6502 programmer! I also regularly use both zero-based and one-based array indices, sometimes within the same subroutine, for similar reasons.

1 Like

Slightly tangential but just noticed this thread is linked… at a Fortran discussion forum, in a mega-thread which might well be of interest:

2 Likes

And almost equally tangential is this description of LLVM, the back-end of clang and many other contemporary language tools. LLVM makes, by my hand count, 95 passes. These are passes over intermediate representation (IR) language, but the IR is still a representation of the program.

(Edit: I hope nobody puts a :heart: on this post. LLVM is important but not lovable. :sweat_smile: )

Does this count C’s macro processing pass?
All computers pre 1978 suffered from lack of memory so just have it
{blah} compile or assemble at all was a major milestone, One needed
to keep the Mag tape on big machines happy,

Note the 4K algol compiler.

All these passes are just in the “back end”, after the “front end” has transformed the code into “intermediate language”. We should probably tank this, it’s off-topic for the forum.

Thanks - I find that pretty interesting. Source files included. SDS offered both a 4k basic and an 8k expanded system, broadly compatible:

Two SDS ALGOL 60 systems are available - a basic system and an expanded system. The basic system requires one pass that generates code in identical format to that of the expanded system; the expanded system uses magnetic tape for intermediate storage and requires two passes. During the first pass, the source program is encoded into concise intermediate language. As a result, processing time is considerably reduced for the second pass, which is essentially I/O limited.

I probably should have known this, but other than FOR loops I see no structured looping or iteration. But recursion is there.

I note that identifier names can include spaces - yikes - but they are not significant.

As for data types:

Integer quantities may take on the value zero or any value representable in two’s complement form in 22 bits.
Real quantities may take on the value zero or any value representable in two’s complement form with a 39-bit fraction and a 9-bit binary exponent.

Fortran II compiler had 29 passes…
That sounds rather high, could it be just a pass number
something like.
Paper tape, pass 11,13,23,29
Disk pass 12,23,21,29

Makes me think of the nanopass framework.