4 ms·
Some 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 c
by kens 12y ago
Some 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.