4 ms·
A 63-pass FORTRAN compiler for the IBM 1401, illustrated
- mauricemir 12y ago63 Passes! and I thought that juggling 8 inch floppies on pdp/11/03's was a pain :-)
- microtherion 12y agoApplying Conway's Law http://en.wikipedia.org/wiki/Conway's_law http://en.wikipedia.org/wiki/Conway's_law one would have to infer that there were 63 teams working on the compiler.
- peter303 12y agoIn those days you were lucking to get a second compilation in a 24 hour period, due to slow compilation and batch queues. You were very careful about finding bugs then. These days with IDE as-you-type compilations I can be rather sloppy about typos.
- DiabloD3 12y agoI wonder how the output compares to modern fortran compilers.
- Sanddancer 12y agoThe final output was interpreted, so it really doesn't compare. Also, Fortran III is pretty close to a completely different language than Fortran 2008, with considerable changes in syntax (the first seven chars no longer are line numbers, etc) and in functions.
- kens 12y agoSome people at the Computer History Museum are trying to get this Fortran compiler operational on their 1401 computers. Meanwhile, someone else is writing a C compiler for the 1401, which is truly crazy - the 1401 violates a lot of the assumptions of C. For example, decimal addresses and arbitrary wordlengths are bad for C. The Fortran compiler is 63 phases (not passes). Each phase contains an average of 150 instructions and a maximum of 300 instructions. Can you imagine that? Breaking a compiler into chunks of 300 instructions? My favorite phase is #8: "Squoze", which squeezes out type-defining words to free up more space. Keep in mind that the compiler, the source, and the output need to fit in 8000 characters, so every character is precious. (Because of decimal addresses, it really is 8000 character, not 8192.) The original paper is here: https://www.cs.sjsu.edu/~mak/archive/CS153/lectures/IBM1401FORTRANCompiler.pdf https://www.cs.sjsu.edu/~mak/archive/CS153/lectures/IBM1401F... The paper estimates that breaking the compiler into 63 phases slows it down under 30%, which is a lot less than I would have expected.
- Someone 12y agoI also find it funny that they sort the program's lines by statement type to float all declarations to the top (or bottom, depending on how you look at it; loading the source code in reverse order makes that a bit ambiguous) That works with fortran because it doesn't (didn't; that has changed since) have dynamic memory allocation or recursion.
- equoid 12y agoReordering could alter the program's semantics as well as being extra work for such limited machines. FORTRAN permitted explicit and implicit declarations. It would be quite legal to use I as an implicit INTEGER variable then later explicitly declare it to be REAL and use it accordingly so the position of the declaration in the source code was significant. Then there are declarations inside subroutines etc.