Hacker News new | ask | show | jobs
by leapis 2097 days ago
Fantastic book, and one that's much needed in the landscape of compiler learning today. Many modern compiler books (such as Torczon & Cooper's "Engineering a Compiler") take the approach of showing low-level, linear IRs rather than actual assembly- a perfectly valid approach, to be sure, but one that leaves something to be desired. While compilers are interesting, I don't learn about them because I think I'll ever write a real one- I learn about them because I want to understand more about a tool at the core of my workflow. This book won't be the be-all end-all of understanding compilation to asm, especially on x86 machines, but it taught me much that my university compilers courses and the Dragon book could not. I was a little hesitant when I saw the book was written with Typescript in mind, but after reading an earlier draft I tend to agree with the author's assessment that it works well with the material, and isn't too hard to pick up with some limited javascript experience.
2 comments

Yeah, and picking a language was the hardest decision for the book. I wrote the compiler prototype for it in OCaml, but using it for the book would have narrowed its audience unnecessarily. In the end, I'm very happy with picking TypeScript: it allowed to discuss the matters of static and dynamic typing within the same language. Using Python with mypy would be another option, but then, since I wanted the source language to be a subset of the implementation language, I would have to explain parsing whitespace-sensitive code, which is tricky.
Thank you for such a favorable comparison with the classics!