Revisiting "Let's Build a Compiler"

Posted by cui 3 hours ago

Counter67Comment5OpenOriginal

Comments

Comment by statictype 1 hour ago

This article sums it up perfectly. I was interested in building a compiler long before going to college and this was the most accessible body of work.

Building a recursive descent parser from scratch was an eye opener to 17yo me on how a seemingly very complex problem that I had no idea how to approach can be made simple by breaking it down into the right primitives.

Comment by xyproto 1 hour ago

"breaking things down into the right primitives" is the real key to programming. There are many books and web pages about algorithms, but I wish there were more searchable and browsable resources for how to approach problems through primitives.

Comment by zwnow 1 hour ago

The process of breaking a complex problem down into the right primitives requires great understanding of the original problem in the first place.

Whats blocking me during programming usually are edge cases I had no idea about. Its still hard to find good material on compilers if you are not into reading dry ass books. Thats a me problem though, I simply cant force myself to read boring factual only content (one of the reasons as to why I love beejs guides).

Comment by fuzztester 3 minutes ago

>a seemingly very complex problem that I had no idea how to approach can be made simple by breaking it down into the right primitives.

https://en.wikipedia.org/wiki/Niklaus_Wirth

From the Publications section of that Wikipedia page:

>The April 1971 Communications of the ACM article "Program Development by Stepwise Refinement",[22][23] concerning the teaching of programming, is considered to be a classic text in software engineering.[24] The paper is considered to be the earliest work to formally outline the top-down method for designing programs.[25][26] The article was discussed by Fred Brooks in his influential book The Mythical Man-Month and was described as "seminal" in the ACM's brief biography of Wirth published in connection to his Turing Award.[27][28]

Comment by hashtag-til 1 hour ago

For modern compiler and a more direct approach I recommend https://www.cs.cornell.edu/~asampson/blog/llvm.html