Could anyone please explain what exactly bootstrapping is?
As far as i know it is something related to "the compiler for C itself wriiten in C"

7 Years
Discussion Span
Last Post by DJSAN10

The story is that if you try to pull on your boots (which you do by holding the bootstraps and pulling upward), and the boots are a 'perfect fit' (very tight), then you might pull yourself up into the air by your bootstraps. Hence the name 'bootstrapping': A compiler that is written in its own language (pulls itself up into usefulness without outside support). If you think about it, you will realize that only the first compiler of a particular language is problematic. Thereafter, you compile version N+1 using version N, then you recompile version N+1 using itself, partly as a test. When I was working with the GNU C++ compiler, as I recall it, that step was repeated until you were satisfied that the executables and libraries were the same after a round of recompilation as they had been before.

Edited by griswolf: n/a


Say you invent Your Language (call it y ). You write a minimal y compiler using C. It is pretty rough, but it is enough to compile an object file that your linker can link; and it recognizes all the y syntax that you need to replicate the behavior of the initial C-based compiler. Call that C-based compiler "y version 0.0"

  1. Using the usual compile, test, fix, recompile sequence, get y v 0.0 working
  2. Now, rewrite the very same compiler using y for the language.
  3. compile, test, fix, recompile until satisfied. You have bootstrapped y , and your version is 0.1

From this point on, you add features using the y language, to the y compiler. At each step, you follow this pattern (if you do it a GNU used to do it):

  1. The usual compile, test, fix, recompile, using version N-1 (the current one)
  2. When ready for production test: Using version N-1, compile the version N compiler as y0
  3. Using version y0, compile the version N compiler as y1
  4. Using version y1, compile the version N compiler as y2
  5. Using version y2, compile the version N compiler as y3
  6. Compare the bits of y2 and y3 If they are the same (except time stamps) then you are done. Rename y2 to y and be happy
  7. If not the same, you need to figure out what caused the difference. Repeat from step 1.

Edited by griswolf: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.