[TUHS] C compiler

Warren Toomey wkt at tuhs.org
Tue Sep 27 08:04:29 AEST 2005

On Mon, Sep 26, 2005 at 03:28:33PM -0400, Bill Cunningham wrote:
>     In some of the eary versions of unix if I'm correct you had to generate
> the C compiler. Now how was that done? Was the compiler written in assembly
> and the assembler generated crt0 crt1 and so on?

If you had a distribution tape, then it came with C compiler binaries and
source. You used the compiler binaries to rebuild the compiler.

Obviously, to get to that point was a bit harder. 
A good reference to this is "The Development of the C Language" by
Dennis Ritchie, available at http://cm.bell-labs.com/cm/cs/who/dmr/chist.html

A quick read seems to indicate that Ken created a language called B which
was patterned on BCPL, with a compiler initially in assembly language. Then
Ken rewrote the B compiler in B and bootstrapped it using the existing
compiler. Then Dennis extended the B language to become NB, which then
evolved to become C.

Along the way, new language features were added in to the compiler,
but the features couldn't be used _in_ the compiler until they worked.
As noted on this page, http://cm.bell-labs.com/cm/cs/who/dmr/primevalC.html,
Dennis says "Evolving compilers written in their own language are careful
not to take advantage of their own latest features."


More information about the TUHS mailing list