5 ms·
On the related note, what would you guys recommend as an introduction to compilers, say for beginners?
by yla92 6y ago
On the related note, what would you guys recommend as an introduction to compilers, say for beginners?
- deleted 6y ago[deleted]
- diehunde 6y agoStanford Compilers Course
- matt_d 6y agoCompilers books: I'd start with "Engineering a Compiler" by Keith Cooper and Linda Torczon. http://craftinginterpreters.com/ http://craftinginterpreters.com/ is also a pretty great, programming-oriented intro, which may be good to work through alongside. For more on the analysis & compiler optimization side, "SSA-based Compiler Design" (http://ssabook.gforge.inria.fr/latest/; http://ssabook.gforge.inria.fr/latest/; GitHub Mirror: https://github.com/pfalcon/ssabook https://github.com/pfalcon/ssabook) is a good follow-up. Further readings: Book recommendations in https://github.com/MattPD/cpplinks/blob/master/compilers.md#books https://github.com/MattPD/cpplinks/blob/master/compilers.md#... as well as program analysis resources (in particular lattice theory, type systems and programming languages theory, related notation): https://gist.github.com/MattPD/00573ee14bf85ccac6bed3c0678ddbef#program-analysis-resources https://gist.github.com/MattPD/00573ee14bf85ccac6bed3c0678dd... Courses: I can recommend the following: https://github.com/MattPD/cpplinks/blob/master/compilers.md#courses https://github.com/MattPD/cpplinks/blob/master/compilers.md#... Particularly (in alphabetical order--I think these are all great, so including highlights of what I've liked about them): - IU P423/P523: Compilers (Programming Language Implementation) - Jeremy Siek, with the course book "Essentials of Compilation: An Incremental Approach" (pretty interesting approach, with programming language features developed incrementally having a fully working compiler at each step, cf. http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf; http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf; implementation language Racket), - KAIST CS420: Compiler Design - Jeehoon Kang (good modern treatment of SSA representation itself, including the use of block arguments, https://mlir.llvm.org/docs/Rationale/Rationale/#block-arguments-vs-phi-nodes https://mlir.llvm.org/docs/Rationale/Rationale/#block-argume..., as well as SSA-based analysis and optimization; Rust as an implementation language), - UCSD CSE 131: Compiler Construction - Joseph Gibbs Politz, Ranjit Jhala (great lecturers, both Haskell and OCaml edition were interesting; fun extra: one of the Fall 2019 lectures (11/26) has an interesting discussion of the trade-offs between traditional OOP and FP compiler implementation), - UCSD CSE 231: Advanced Compiler Design - Sorin Lerner (after UCSD CSE 131: for more on analysis & optimization--data flow analysis, lattice theory, SSA, optimization; fun extra: the final Winter 2018 lecture highlighted one of my favorite papers, https://pldi15.sigplan.org/details/pldi2015-papers/31/Provably-Correct-Peephole-Optimizations-with-Alive https://pldi15.sigplan.org/details/pldi2015-papers/31/Provab...), - UW CSE CSEP 501: Compilers - Hal Perkins (nice balanced introduction, including x86-64 assembly code generation, with the aforementioned "Engineering a Compiler" used as the course textbook).
- spekcular 6y agoThank you so much for this comment. It's incredibly difficult to find modern compiler learning resources – when I ask, I often get disparaging comments about the dragon book and not much more. Please, consider putting this list on your blog, or somewhere more visible than a HN comment.
- pfalcon 6y ago> disparaging comments about the dragon book How's that possible? It's a "keep it under your pillow" book. Whether you read it or not is a different question. I don't know anyone in the 'hood who wouldn't have.
- mhh__ 6y agoEngineering a compiler is by far the best introductory book that is also modern. Advanced compiling for high performance is one of not many good accounts of scheduling for non-toy architectures. Muchnick's book is a good encyclopedia of optimisations although the code is unreadable and buggy.
- gilmi 6y agocs4410[1] is really really good, and cse131[2] is basically the same thing but with videos. I highly recommend them both. [1]: https://course.ccs.neu.edu/cs4410/ https://course.ccs.neu.edu/cs4410/ [2]: https://ucsd-cse131-f19.github.io/ https://ucsd-cse131-f19.github.io/
- brundolf 6y agoCrafting Interpreters has been great. It starts with an AST-walking interpreter (in Java), so you get to focus on parsing and the simplest form of interpretation, and then it moves to a bytecode interpreter (in C) so you get to learn about compiling to a more primitive target via a lower-level language (much of which should translate to a "real" compiler). Very approachable, has lots of side-context and an entertaining style. The language you interpret was custom-designed for the course, which helps a lot, and resembles a simplified JavaScript without all the messy parts.
- munificent 6y agoAuthor here. Also you can read the whole book online for free: http://craftinginterpreters.com/ http://craftinginterpreters.com/
- UncleEntity 6y agoI've been reading "Modern Compiler Design" currently, not too sure how beginner friendly it is though. Also, haven't made it too far into the book so can't really give a recommendation either way.