Compiling a compiler

Install a compiler package. There may be another way, but that may be much more difficult that it may need the savvy of a developer.
 
How do you write an operating system, if you have no operating system? Pencil and paper. I'm old enough to have written assembly code in pencil and paper, and assembled it myself, and then typed the binary code into a low-level "monitor" program that came in ROM on my computer. That code coincidentally was the BIOS (the IO system, like device drivers) for cp/m; once I had that working, I was able to boot cp/m.

How do you load the first operating system, if you have no operating system, not even a ROM monitor? You toggle it into the front panel switches. Early computers had complex consoles, which allowed reading and writing memory, and executing individual instructions. For example, I used to use a 24-bit minicomputer (sold in Europe as the Philips P7000, and in the US as "Four Phase Systems") which had no ROM monitor. To boot it, you had to toggle in three or four instructions from the panel and execute them; those were something like "initialize the CPU control word", "load a specific sector from the disk controller", and "branch to that sector".

There is a story (probably apocryphal) that Seymour Cray toggles the while first OS for an early computer (the Univac 1103 or the first CDC) into the front panel, from written notes, then stored it on disk, from which it was distributed.
 
As I recall, some compilers can bootstrap themselves using scripts to build a minimal base and then using that to build its components. The GNU compiler used to be able to bootstrap itself in some environments.
 
I
How do you compile a compiler if you don't have a compiler?
If you have the grammar, you can generate C code for a parser by using yacc(1), but you need a C compiler to compiler your compiler. Once you compile your compiler, then you can compile your language with your compiler.

You just need “a language” you can write your compiler in. The versy first compiler goes back to punch cards. Once you can program a computer, making a compiler is no brainer (well, it is in fact).
 
Back
Top