Ask HN: Recommend an introductory course on compilers
I am doing Bachelors in Information Technology and to my bad luck, my curriculum does not have a course on compilers. I looked online and found one on Coursera only to realize that it has now been removed. Could you guys recommend a good compilers course or book which gives a good introduction to the topic along with a guided practical implementation? I would be much obliged.
22 comments
[ 2.9 ms ] story [ 28.4 ms ] threadhttp://compilers.iecc.com/crenshaw/
It was written with Turbo Pascal in mind but many have read the text and transcribed the instructions to a language of their choosing. Should be at least a good introduction to compilers.
For me, its shining moments are the explanations of abstruse algorithms. The text takes the time to work through interesting example runs of the algorithms that illustrate all the facets of the computation. This was critical to my understanding of how the algorithms work, why they need to work that way, and how competing algorithms differ.
It's also not the kind of book that needs to be read cover to cover. We went through the chapters out of order. If you can find matching lecture slides, that can be a great guide or survey of the material.
I got almost nothing out of the book Engineering a Compiler.
Aside from that the class was amazing. Maybe the next edition has become excellent? I knew people who took the class using the Dragon book and found that book unhelpful too.
I'm currently reading Wirth's book and really enjoying it though.
https://news.ycombinator.com/item?id=13207695
Here are the links:
https://www.cs.swarthmore.edu/~jpolitz/cs75/s16/index.html
https://github.com/compilers-course-materials/
https://github.com/compilers-course-materials/cs75-s16-lectu...
http://llvm.org/docs/tutorial/
These are examples in C++ and OCaml.
There's a similar tutorial in Python as well, which should be easier to get running:
http://www.llvmpy.org/llvmpy-doc/0.9/doc/kaleidoscope/Python...
The inline docs are super well written, clear and extensive. It's also implemented in JabaScript.
It's an amazing learning tool and I really loved reading it!
https://github.com/thejameskyle/the-super-tiny-compiler
https://ocw.mit.edu/courses/electrical-engineering-and-compu...
Edit: here's some videos https://ocw.mit.edu/courses/electrical-engineering-and-compu...
Also maybe check out the recommended text: Modern Compiler Implementation in Java (Tiger Book)
And a few more resources here: http://cons.mit.edu/sp14/references.html
Until now I think it is good (I'm in the second week of the course).
https://howistart.org/posts/nim/1
As well as playing a bit with ometa:
http://www.tinlizzie.org/ometa-js/#Sample_Project
Over the course of the book you implement compiler construction tools (a LEX clone and two YACC clones) and then use those to build a C compiler.
1) Theory of computation (can't recommend a book for this one)
2) Programming language theory (Book: Programming Language Pragmatics)
3) Compiler construction (Book: Engineering a compiler or the Dragon Book)
Ullman used to have a course on Automata via Coursera but the platform changes have sent it down the memory hole.
It's self-paced now.
A tour through a clean subset of a C compiler, full C source code included. It's not exactly a course, but will introduce all basic parts of compiler construction on the theoretical and practical level: lexing, parsing, code generation, optimization, and runtime support. The complete code from the book is in the public domain: http://t3x.org/subc
For the record: I'm the author.