<story><title>Small C Compilers</title><url>https://bootstrapping.miraheze.org/wiki/Main_Page#Small_C_Compilers</url></story><parent_chain><item><author>snagglegaggle</author><text>&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;rswier&amp;#x2F;c4&amp;#x2F;blob&amp;#x2F;master&amp;#x2F;c4.c&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;rswier&amp;#x2F;c4&amp;#x2F;blob&amp;#x2F;master&amp;#x2F;c4.c&lt;/a&gt;&lt;p&gt;Holy what</text></item><item><author>codezero</author><text>I love c4. The author writes very readable and simple code. I recommend trying out swieros as well “a tiny Unix like kernel”: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;rswier&amp;#x2F;swieros&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;rswier&amp;#x2F;swieros&lt;/a&gt;</text></item></parent_chain><comment><author>dTal</author><text>Instead of just gazing at the sea of terse variable names in awe, try actually reading it! There&amp;#x27;s only about a dozen variables and they&amp;#x27;re all documented at the top - the actual code is actually amazingly clear for what it does. There&amp;#x27;s not a lot of gratuitous cleverness.&lt;p&gt;For example, just picking a random segment, you don&amp;#x27;t have to squint very hard to see that this is a number literal parser:&lt;p&gt;&lt;pre&gt;&lt;code&gt;  else if (tk &amp;gt;= &amp;#x27;0&amp;#x27; &amp;amp;&amp;amp; tk &amp;lt;= &amp;#x27;9&amp;#x27;) {
        if (ival = tk - &amp;#x27;0&amp;#x27;) { while (*p &amp;gt;= &amp;#x27;0&amp;#x27; &amp;amp;&amp;amp; *p &amp;lt;= &amp;#x27;9&amp;#x27;) ival = ival * 10 + *p++ - &amp;#x27;0&amp;#x27;; }
        else if (*p == &amp;#x27;x&amp;#x27; || *p == &amp;#x27;X&amp;#x27;) {
        [...goes on to handle the hexadecimal case...]
&lt;/code&gt;&lt;/pre&gt;
(aside - I love the conversion from string to decimal by subtracting the string value of &amp;#x27;0&amp;#x27;, as this will work for any text encoding where the decimal digits are monotonic and contiguous - so ASCII and EBDIC at least...)</text></comment>
<story><title>Small C Compilers</title><url>https://bootstrapping.miraheze.org/wiki/Main_Page#Small_C_Compilers</url></story><parent_chain><item><author>snagglegaggle</author><text>&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;rswier&amp;#x2F;c4&amp;#x2F;blob&amp;#x2F;master&amp;#x2F;c4.c&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;rswier&amp;#x2F;c4&amp;#x2F;blob&amp;#x2F;master&amp;#x2F;c4.c&lt;/a&gt;&lt;p&gt;Holy what</text></item><item><author>codezero</author><text>I love c4. The author writes very readable and simple code. I recommend trying out swieros as well “a tiny Unix like kernel”: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;rswier&amp;#x2F;swieros&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;rswier&amp;#x2F;swieros&lt;/a&gt;</text></item></parent_chain><comment><author>megous</author><text>A bit terse perhaps, but only thing that is a bit more than a simple tokenization&amp;#x2F;parsing and direct output is the precedence climbing part for parsing expressions. That may cause some headscratching for some if they haven&amp;#x27;t implemented it in the past. But it&amp;#x27;s easy to read up on that algorithm on wikipedia. Anyway, even using that ultimately makes code more readable than trying to implement the same with recursive descent.</text></comment>