<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>quincunx</author><text>After grinding through a bunch of compiler books I have to mention &amp;quot;Modern Compiler Implementation in C - Andrew A. Appel&amp;quot;: &lt;a href=&quot;http:&amp;#x2F;&amp;#x2F;www.amazon.co.uk&amp;#x2F;dp&amp;#x2F;0521607655&quot; rel=&quot;nofollow&quot;&gt;http:&amp;#x2F;&amp;#x2F;www.amazon.co.uk&amp;#x2F;dp&amp;#x2F;0521607655&lt;/a&gt; as one that stands out.&lt;p&gt;For LALR Parsers and DFA scanners and the like, I found the original Dragon Book &lt;a href=&quot;http:&amp;#x2F;&amp;#x2F;www.amazon.co.uk&amp;#x2F;dp&amp;#x2F;B00EKYURHS&quot; rel=&quot;nofollow&quot;&gt;http:&amp;#x2F;&amp;#x2F;www.amazon.co.uk&amp;#x2F;dp&amp;#x2F;B00EKYURHS&lt;/a&gt; is still best.&lt;p&gt;Both books are very accessible reading.</text><parent_chain><item><author>w23j</author><text>Can somebody point me at some introductionary material (or approachable code base) to writing an &lt;i&gt;optimizing&lt;/i&gt; compiler?&lt;p&gt;There seem to be a lot of very good tutorials on writing a simple compiler, like
&lt;a href=&quot;http:&amp;#x2F;&amp;#x2F;scheme2006.cs.uchicago.edu&amp;#x2F;11-ghuloum.pdf&quot; rel=&quot;nofollow&quot;&gt;http:&amp;#x2F;&amp;#x2F;scheme2006.cs.uchicago.edu&amp;#x2F;11-ghuloum.pdf&lt;/a&gt;
&lt;a href=&quot;http:&amp;#x2F;&amp;#x2F;compilers.iecc.com&amp;#x2F;crenshaw&amp;#x2F;&quot; rel=&quot;nofollow&quot;&gt;http:&amp;#x2F;&amp;#x2F;compilers.iecc.com&amp;#x2F;crenshaw&amp;#x2F;&lt;/a&gt;&lt;p&gt;There are also readable code bases like tinyc or this one.&lt;p&gt;However these always use a simple template based approach to code generation and stop there.&lt;p&gt;Of course there are real world compiler (lvm, gcc, ...). However because of their size and complexity it&amp;#x27;s hard to learn from them.&lt;p&gt;What I am interested in would be going from:
&amp;quot;I have an AST and for this node type I output this assembly.&amp;quot;
to
&amp;quot;I translate the AST to an IR. Transform an the IR in multiple passes and finally output decent asm.&amp;quot;&lt;p&gt;That is, something that talks about CFG analysis, register scheduling or maybe SSA form? I have read papers on SSA and Sea-of-Nodes IRs, but these of course always assume that you know how and why to use them. A more approachable text&amp;#x2F;github-repo that shows how to take the step from template base code gen to more advanced techniques would be great.&lt;p&gt;(I hope it is ok to ask this here. Did not want to hijack the thread.)</text></item></parent_chain></comment><story><title>Self hosted C – breakdown</title><url>http://achacompilers.blogspot.com/2015/12/self-hosted-c-breakdown.html</url></story>
<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>rayiner</author><text>This one is very readable: &lt;a href=&quot;http:&amp;#x2F;&amp;#x2F;www.amazon.com&amp;#x2F;Engineering-Compiler-Second-Edition-Cooper&amp;#x2F;dp&amp;#x2F;012088478X&quot; rel=&quot;nofollow&quot;&gt;http:&amp;#x2F;&amp;#x2F;www.amazon.com&amp;#x2F;Engineering-Compiler-Second-Edition-Co...&lt;/a&gt;.&lt;p&gt;Corresponding lecture notes: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;www.clear.rice.edu&amp;#x2F;comp412&amp;#x2F;Lectures&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;www.clear.rice.edu&amp;#x2F;comp412&amp;#x2F;Lectures&lt;/a&gt;.</text><parent_chain><item><author>w23j</author><text>Can somebody point me at some introductionary material (or approachable code base) to writing an &lt;i&gt;optimizing&lt;/i&gt; compiler?&lt;p&gt;There seem to be a lot of very good tutorials on writing a simple compiler, like
&lt;a href=&quot;http:&amp;#x2F;&amp;#x2F;scheme2006.cs.uchicago.edu&amp;#x2F;11-ghuloum.pdf&quot; rel=&quot;nofollow&quot;&gt;http:&amp;#x2F;&amp;#x2F;scheme2006.cs.uchicago.edu&amp;#x2F;11-ghuloum.pdf&lt;/a&gt;
&lt;a href=&quot;http:&amp;#x2F;&amp;#x2F;compilers.iecc.com&amp;#x2F;crenshaw&amp;#x2F;&quot; rel=&quot;nofollow&quot;&gt;http:&amp;#x2F;&amp;#x2F;compilers.iecc.com&amp;#x2F;crenshaw&amp;#x2F;&lt;/a&gt;&lt;p&gt;There are also readable code bases like tinyc or this one.&lt;p&gt;However these always use a simple template based approach to code generation and stop there.&lt;p&gt;Of course there are real world compiler (lvm, gcc, ...). However because of their size and complexity it&amp;#x27;s hard to learn from them.&lt;p&gt;What I am interested in would be going from:
&amp;quot;I have an AST and for this node type I output this assembly.&amp;quot;
to
&amp;quot;I translate the AST to an IR. Transform an the IR in multiple passes and finally output decent asm.&amp;quot;&lt;p&gt;That is, something that talks about CFG analysis, register scheduling or maybe SSA form? I have read papers on SSA and Sea-of-Nodes IRs, but these of course always assume that you know how and why to use them. A more approachable text&amp;#x2F;github-repo that shows how to take the step from template base code gen to more advanced techniques would be great.&lt;p&gt;(I hope it is ok to ask this here. Did not want to hijack the thread.)</text></item></parent_chain></comment><story><title>Self hosted C – breakdown</title><url>http://achacompilers.blogspot.com/2015/12/self-hosted-c-breakdown.html</url></story>