<story><title>I wrote a self-hosting C compiler in 40 days (2015)</title><url>http://www.sigbus.info/how-i-wrote-a-self-hosting-c-compiler-in-40-days.html</url></story><parent_chain></parent_chain><comment><author>pklausler</author><text>That&amp;#x27;s about how long it took me to write a self-compiling C compiler and basic runtime library for a simulation environment for a new instruction set architecture back in &amp;#x27;98 (it eventually became the Cray X-1).  Although I did start with a working C preprocessor left over from an earlier project, and in many ways the preprocessor can be the hardest part to get right.&lt;p&gt;Bringing up a compiler in a simulated environment has its advantages over real metal.  Seeing instruction traces with computed values is awesome for debugging.</text></comment>
<story><title>I wrote a self-hosting C compiler in 40 days (2015)</title><url>http://www.sigbus.info/how-i-wrote-a-self-hosting-c-compiler-in-40-days.html</url></story><parent_chain></parent_chain><comment><author>sly010</author><text>&amp;gt; At first the compiler was about 20 lines long, and the only thing that was able to do is to read an integer from the standard input and then emit a program that immediately exits with the integer as exit code.&lt;p&gt;I always find it hard to find the absolute minimum functionality i can implement so I usually just attack the problem hard, fail, and keep repeating until I have enough broken functionality, then I start adding tests and refactoring.&lt;p&gt;Can I ask what is your day job? :)</text></comment>