- Its All Bits and Bytes
- The Rise of Structure
- Higher Abstractions
- Rise of the Type Theorists
Higher Abstractions
Procedures enabled programs to be structured more cleanly than the tangled nest of jumps, but they were a bit more effort to use. Every time you wanted to call a subroutine, you needed to push the parameters and return address onto the stack and then jump. At the far end, you needed to do the same operation in reverse.
Entering this same sequence of instructions repeatedly was a lot of effort, so the idea of the macro assembler arrived.
A macro assembler allowed symbols to be defined representing sequences of instructions.
Things such as a function prologue and epilogue—the sequence of instructions needed at the start and end of a subroutine—could be replaced by single symbols, reducing the amount of typing required.
Programmers began accumulating collections of macros for common activities, and their code eventually began to resemble high-level descriptions of the algorithm.
These sets of macros gradually evolved into complete languages. One thing that macros could not do is free the programmer from the need to manually allocate registers.
Most modern architectures can only perform computations on values stored in registers, of which there are typically between 8 and 32. A programmer must load values from memory into registers, perform the calculations, and then store them back out to memory.
Another drawback of assembly language programming was that code was still tied to a specific instruction set, even with a heavy use of macros. This made moving from one architecture to another a significant investment.
The first high-level languages, such as FORTRAN, solved both of these problems. The compiler would handle register allocation, and the only thing that would need to be rewritten for a new architecture was the compiler.
The compiler itself could be written in a high-level language, so only the code generation part needed to be rewritten, and the rest just needed to be recompiled on the new version.