Monday, January 12, 2009

Re-creating source code, Part 7

So, how do you compile a compiler?

It seems pretty straight forward, something like
      make compiler
and in many cases this is all that is necessary. But not always.

Many languages (like C or Pascal) are written in themselves (i.e. C compilers are written in C, Pascal compilers are written in Pascal). But, how do you get the first compiler compiled? This is known as bootstrapping a compiler.

If this is really the first instance of the language (i.e. you are Dennis Ritchie triumphantly creating the C language), your first compiler, however primitive, is written in another language. Later versions of the compiler are then written in the language itself.

If the language already exists on one computer and you are bringing it to a new system, you can either write the compiler in an already existing language for the new system, or you can use a cross compiler to generate the first generation of the compiler for a new system.

So, what does this have to do with re-creating an early version of the DeSmet C source?

Well, what compiler was used to compile DeSmet C?

No comments: