Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

This is one thing I find funny about this book. Despite the name, it's a great intro to compilers in general.


sort by: page size:

Great article. I've been interested in compilers since my college class and this scratches the itch.

Thank you for the link. I'm always looking for books on compilers, but they can be hard to find. Many of them are every from the ivory tower-like unfortunately.

On the related note, what would you guys recommend as an introduction to compilers, say for beginners?

"Writing a Compiler is Surprisingly Easy (part 1/72)"

Joke aside, great work up! Thank you.


I'm usually scared to look at these compilers titled articles, feeling I do not understand or learn anything from it.

This article is a very good intro to compilers and now I understood how these things work. Thanks for the article.


Crafting Interpreters by Nystrom.

It's great because of how accessible it makes compilers to average programmers, and, as a bonus, it also throws shade at the overly dense compiler textbooks:

"Classic compiler books read like fawning hagiographies of these heroes and their tools. The cover of Compilers: Principles, Techniques, and Tools literally has a dragon labeled “complexity of compiler design” being slain by a knight bearing a sword and shield branded “LALR parser generator” and “syntax directed translation”. They laid it on thick." (chapter 6)

Having read Compilers for a compilers course in college, Crafting Interpreters was a fun read on many levels.


I used this book to teach compilers. Good book.

We did a lot of this in our compilers class. A lot of fun.

This looks awesome! Now to read about compilers....

If you're unfamiliar with it but want to learn about compilers, a text in a language you know will decrease the cognitive load.

If you would like a heartwarming tale of an engineers first compiler, this is the article for you.

There is either nothing to learn here, or a spectacular insight into compilation, depending on where you are in your career.

Compilers are fun. It’s an invaluable experience having written one. There is no magic left in a computer once you’ve written a compiler.

If you have written a compiler, this article is amusing. You get to see a programmers eyes open.

If you have not written a compiler, you get some insight about how they work- but perhaps you get more insight about how you work.

Also, the author should constant fold his arithmetic example. It slows down compile time, but makes the program faster.


I just found about this page yesterday while doing a google search for various compiler books and posted it to reddit in /r/compilers, looks like it's now spreading. I'm really interested if anyone has read this book yet. I've just started and am currently reading Chapter 3.

It seems as if nobody seems to recommend this book, perhaps it just wasn't noticed before? Thanks for posting to hn.


I know nothing about this topic. But saw this book once and made me excited about compilers. Maybe one day I'll go for it: https://compilerbook.com

The article looks really interesting, can't wait to dig in!

Side note: the articles on compilation also seem to be good and simple to understand, especially the one about code generation (which is a topic that other articles somehow always skip)


Thanks for this fantastic link. I will share it with my students at the end of my intro to compilers class.

have fun learning about devirtualisation and compiler theory

Have you ever studied compilers? You'll gets a good idea of these concepts from a toy compiler for an imperative language.

This is really cool, thanks for posting this. I've always been vaguely curious how compilers work, but have never set aside time to research it. This was a great introduction, I have a better beginner's notion of how they work now :)

Pretty entertaining, if a bit melodramatic.

I really wish people didn't mystify such a basic programming skill. Compiler hacking is something reserved for the wizards only if you take the classic definition of compiler implementation: an expensive engineering project, targeting a new processor, architecture or OS.

In that sense, sure. You will be working in a lab with hundreds of developers, and tinkering with a piece of multimillion dollar prototype.

In reality, however, "compiler construction" boils down to foundational language theory, along with various tricks and techniques for translating a set of very straightforward algebriac rules, to another set. Anytime you write regexes or XPath to extract a set of fields from a documents and transform to something "readable", you're almost writing a simple one pass assembler, using some implicit "business rules" (i.e. all numbers should be floats, names capitalized, etc.) for productions.

Compiler skills will give you the theoretical backbone to discover, refine and assess those implicit rules. Not to mention techniques for transforming them from one form to another.

To the list of skills made mystical and magical by people I would add Lisp. It's not magic. I mention it because it just so happens to have compiler construction lore aplenty.

The first Lisp exercises you will read in your lisp book of choice (often requiring nothing more than basic English literacy and 6th grade arithmetic) are the expression simplification and evaluation exercises. Transforming your elementary school algebra rules (multiplication and division before addition and subtraction, etc.) to something the machine can execute. The hardest part is just understanding the words: if you have a hunch for what "expression", "term", "rule", "left/right hand-side" and "precedence" might mean, you're good to start.

Few chapters of a Lisp book will spare you volumes of traditional compiler construction techniques, taught by rote methods.

The first time I attempted to read SICP I had convulsions and physical pain. The whole time I had this inferiority complex nagging at me, telling me this was something for "smart kids" and I was unworthy. But this stopped after I went through the first few parts of chapter 1, and took in the playful tone the text. I felt stupid afterward; like being afraid of a St. Bernard. It looks big, but it's actually bubbly.

Don't listen to people when they say something is difficult or not for the faint of heart. Put a saddle on Falkor and go flying!

next

Legal | privacy