replacing the bootstrap compiler. The full compiler is built twice in order to compare the outputs of the two stages. If they are different, either the bootstrap or the full compiler contains a bug. Advantages Bootstrapping a compiler has the following advantages: It is a non-trivial test of the language being compiled, and as such is a form of dogfooding. Compiler developers and bug reporters only need to know the language being compiled. Compiler development can be performed in the higher-level language being compiled. Improvements to the compiler's back-end improve not only general-purpose programs but also the compiler itself. It is a comprehensive consistency check as it should be able to reproduce its own object code. Note that some of these points assume that the language runtime is also written in the same language. Methods If one needs to compile a compiler for language X written in language X, there is the issue of how the first compiler can be compiled. The different methods that are used in practice include: Implementing an interpreter or compiler for language X in language Y. Niklaus Wirth reported that he wrote the first Pascal compiler in Fortran. Another interpreter or compiler for X has already been written in another language Y; this is how Scheme is often bootstrapped. Earlier versions of the compiler were written in a subset of X for which there existed some other compiler; this is how some supersets of Java, Haskell, and the initial Free Pascal compiler are bootstrapped. A compiler supporting non-standard language extensions or optional language features can be written without using those extensions and features, to enable it being compiled with another compiler supporting the same base language but a different set of extensions and features. The main parts of the C++ compiler clang were written in a subset of C++ that can be compiled by both g++ and Microsoft Visual C++. Advanced features are written with some GCC extensions. The compiler for X is cross compiled from another architecture where there exists a compiler for X; this is how compilers for C are usually ported to other platforms. Also this is the method used for Free Pascal after the initial bootstrap. Writing the compiler in X; then hand-compiling it from source (most likely in a non-optimized way) and running that on the code to get an optimized compiler. Donald Knuth used this for his WEB literate