<story><title>Goodbye to the C++ Implementation of Zig</title><url>https://ziglang.org/news/goodbye-cpp/</url></story><parent_chain><item><author>dahfizz</author><text>Something I&amp;#x27;ve always wondered about compilers written in their own language....&lt;p&gt;What is your process for compiling a new compiler? Let&amp;#x27;s say you make a code change to the compiler. You have a compiled version of the previous compiler you can run to compile the new compiler.&lt;p&gt;But, by definition, the new compiler is different from the old one. Do you re-run the compilation with the new compiler? How many times?</text></item><item><author>WalterBright</author><text>It was a good day when we finally removed 100% of the C and C++ code from the D compiler and all of the runtime library (including the memory manager). The assembler code uses D&amp;#x27;s inline assembler.&lt;p&gt;The &lt;i&gt;test&lt;/i&gt; suite has C code in it, because of course D can compile C code.</text></item></parent_chain><comment><author>cpeterso</author><text>Rust’s documentation describes how new versions of the rustc compiler are bootstrapped:&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;rustc-dev-guide.rust-lang.org&amp;#x2F;buildings&amp;#x2F;bootstrapping.html&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;rustc-dev-guide.rust-lang.org&amp;#x2F;buildings&amp;#x2F;bootstrappin...&lt;/a&gt;&lt;p&gt;Stage 0: The stage0 compiler is usually the current beta rustc compiler.&lt;p&gt;States 1: The rustc source code is then compiled with the stage0 compiler to produce the stage1 compiler.&lt;p&gt;Stage 2: We then rebuild our stage1 compiler with itself to produce the stage2 compiler. In theory, the stage1 compiler is functionally identical to the stage2 compiler, but in practice there are subtle differences. The stage2 compiler is the one distributed with rustup and all other install methods.&lt;p&gt;State 3: To sanity check our new compiler, we can build the libraries with the stage2 compiler. The result ought to be identical to before, unless something has broken.</text></comment>
<story><title>Goodbye to the C++ Implementation of Zig</title><url>https://ziglang.org/news/goodbye-cpp/</url></story><parent_chain><item><author>dahfizz</author><text>Something I&amp;#x27;ve always wondered about compilers written in their own language....&lt;p&gt;What is your process for compiling a new compiler? Let&amp;#x27;s say you make a code change to the compiler. You have a compiled version of the previous compiler you can run to compile the new compiler.&lt;p&gt;But, by definition, the new compiler is different from the old one. Do you re-run the compilation with the new compiler? How many times?</text></item><item><author>WalterBright</author><text>It was a good day when we finally removed 100% of the C and C++ code from the D compiler and all of the runtime library (including the memory manager). The assembler code uses D&amp;#x27;s inline assembler.&lt;p&gt;The &lt;i&gt;test&lt;/i&gt; suite has C code in it, because of course D can compile C code.</text></item></parent_chain><comment><author>WalterBright</author><text>1. Compile the new compiler with the old compiler&lt;p&gt;2. Compile the new compiler with the result of (1)&lt;p&gt;3. Compile the new compiler with the result of (2)&lt;p&gt;4. Verify that (2) and (3) produce identical results</text></comment>