Join the discussion
Write your take first — we'll ask for email only when you're ready to publish.
- Hacker News
- Great material! Thank you.by flash1
- I'm super curious what alexia massalin is up to these days, besides collecting microunity patent royaltiesby gaze
- Thanks for creating and sharing this.by ken47
- Saw a podcast that talked about the rust compiler, which apparently included machine learning algorithms at some points to determine whether or not you had code that could crash your systemby GL26
- I've never heard about that and I'm pretty sure it's incorrect (although "machine learning" is a wide term), do you have a source for that?by afdbcreid
- Are there any other self-guided online university level CS courses like this?by sincerely
- There are dozens. Search "mooc". Also some professors will release their lectures and homework outside of a "mooc" framework. I've even had professors respond to questions in the comments. The Internet can still be pretty cool.
- Is there also a self guided course for "basic compilers", before stepping into an advanced level?by awesomeMilou
- Haven't tried it myself, but there is "the-super-tiny-compiler": https://github.com/jamiebuilds/the-super-tiny-compilerby ursula_gren
- I'd say check out Crafting Interpreters [1]. It has 2 parts, the first in Java for doing a treewalk Interpreter in Java before going farther with a version written in C.by runevault
- I suggest starting with the old but classic Compiler Construction for Digital Computers by David Gries. Pair it with some modern books recommended here and you should be good.
David Gries - https://www.cs.cornell.edu/gries/ and https://en.wikipedia.org/wiki/David_Gries
Dutch computer scientist Dick Grune has written of Compiler Construction for Digital Computers that "entire generations of compiler constructors have grown up with it and they have not regretted it."
Note that Dick Grune himself is famous for his books on compilers/programming languages - https://dickgrune.com/index.html and https://en.wikipedia.org/wiki/Dick_Grune
by rramadass - I'm a fan of the structure used in Essentials of Compilation [1][2] and Writing a C Compiler [3]. If you want to start with interpreters, I like Essentials of Programming Languages [4]. I have to admit, as popular as Crafting Interpreters is on this site and others, I'm not a fan. Others seem to love it so it's worth a shot, and freely available.
EOC and EOPL are a bit on the academic side, but, I think, they're highly approachable aside from the issues some people have with Scheme and Racket (the Python version of EOC would address that issue). Afterwards, I think the other, deeper and more academic texts on compilers become more approachable.
[1] https://mitpress.mit.edu/9780262047760/essentials-of-compila... - Racket version, has an open access version
[2] https://mitpress.mit.edu/9780262048248/essentials-of-compila... - Python version, has an open access version
[3] https://nostarch.com/writing-c-compiler - Your choice of implementation language
[4] https://mitpress.mit.edu/9780262062794/essentials-of-program... - Scheme, but works in Racket
by Jtsummers - How does this compare to Nora Sandler's "Writing a C compiler" in terms of the potential gains for the reader?by xqb64
- Her book sits closer to what you'd get from an undergraduate level compilers course, this course covers more advanced material than she does. If you're a novice or a dabbler, start with her book or something else at that level, then try out this course and fill in the gaps as needed.by Jtsummers
- I found that book to be basically useless as a passive reader.
She basically writes "do this" and you are supposed to do it.
This course is much more valuable because it actually gives a lot of information.
It really feels like most text books on compilers have massive "black hole" sections that pull you in on the technicals that you are not even supposed to use in the end.
I found that his course and the LLVM book by Quentin Colombet really useful because they both give easy to understand information that seems to be actually used in real large systems like LLVM/gcc etc.
There are also book like SSA-based compiler design that seem to be great but I am not able to read because of lacking prior knowledge.
Also thank you to Adrian if he is reading this, he is an amazing teacher and releasing this content is much appreciated
by ozgrakkurt - I'm a bit confused about what makes this course "advanced." Most of the topics (dead code elimination, data flow, dominator analysis, SSA form) seem like they belong in a first course on compilers.by j2kun
- What is advanced then? Good coverage of dce, data flow, ssa, intruction selection and reg alloc is actually like 98% of the backend.by vkazanov
- I think a lot of the non-professionals start with parsing and do not get exposed to backend. I have read two books about interpreters/compilers and they don't touch the backend very much.
Maybe this is introductory for backend?
by ferguess_k - I have read TONS of material about it*, and none of that is part of the majority of that!
In fact, the "backend" be compiler or interpreter is nearly always left as "exercise to reader".
You can't imagine how much is left to be discovered, from how make a closure, track environment, do pattern matching, memory representation, etc.
EVERYTHING interesting is something you need to look for.
P.D: This only one of the years:https://gist.githubusercontent.com/mamcx/e1743571b9a1ea163a7...
by mamcx - Well, course numbers are regular enough that you can look up what the "intro compilers" course is: https://www.cs.cornell.edu/courses/cs4120/2026sp/?schedule
The short answer is that compilers is basically broken up into two courses, with the first course largely being the minimum necessary to build a compiler (lexing, parsing, codegen, register allocation), and the second course being how to build an optimizing compiler.
by jcranmer - Previously...
CS 6120: Advanced Compilers: The Self-Guided Online Course - https://news.ycombinator.com/item?id=39577878 - March 2024 (102 comments)
Advanced Compilers: Self-Guided Online Course - https://news.ycombinator.com/item?id=35130975 - March 2023 (82 comments)
Advanced Compilers: Self-Guided Online Course - https://news.ycombinator.com/item?id=25386756 - Dec 2020 (232 comments)
by tomhow - The section on dynamic compilers is more or less all about trace compilation. Generally, trace compilation is a dead end and has been abandoned repeatedly. The more important concepts here are type feedback and speculation and deoptimization, as well as making fast compilers and tiering.
The course overall looks good, and it's great that so much is available online, so well done, Adrian.
by titzer - Got any other recommended resources on building compilers?
- Has LuaJIT been superseded?by abecedarius
- Tracing JIT compilers are very interesting, and there definitely needs to be more resources on such complex topic.
- Trace compilation is NOT a dead end.
LuaJIT works just fine. On big programs. On hundreds of millions of servers and devices.
I find it deeply saddening that even scholars keep repeating this trope. Ignorance is bliss.
by mikemike - The TraceMonkey paper was on my qual reading list, and my quals happened to be around the time TraceMonkey was ripped out of SpiderMonkey. I was talking with one of the developers at the time (I think it was Jason Orendorff?), who said that tracing just doesn't work out, but there was limited circumstances where he thought it might work out... but I've completely forgotten what those circumstances were.by jcranmer
- > Generally, trace compilation is a dead end and has been abandoned repeatedly.
JAX is a tracing compiler!
(I know, I know, it sits in an extremely different part of the problem space than TraceMonkey or LuaJIT. Still.)
by jlebar - I work on PyTorch torch.compile and it’s a tracing compiler as well. Perhaps this domain is very narrow though; it is also a very not conventional compiler, you’d probably be deeply offended by some of the stuff we do! ;)by mlazos
- Thanks, Ben. I admit I mostly think tracing is just a mind-expanding concept to learn about, even if history has proven it’s not very practical as an organizing principle. But as you say, I’d love to offer more context on “what actually seems to work” industrially.by samps