Advanced Compilers: Self-Guided Online Course
cs.cornell.edu
cs.cornell.edu
My prof developed a production SML compiler that's fairly widely used, so he was the best resource I could have asked for. Such a humble guy as well. The thing that was most interesting to me was the use of ADTs on the implementation end. I couldn't imagine how much more tedious it would be dealing with the many types of trees a compiler deals with without them.
The class's impact on my overall career isn't direct, as I don't work near the compiler space at all (unfortunately), but there were so many good type level concepts I got out of that course. Plus, it was just a blast. Late nights with a bunch of tmux panes ironing out bugs to rack up test coverage - such fond memories :)
I highly recommend playing with compiler implementation for anyone that's unfamiliar. There are a lot of good introductory resources out there and they're just such a fascinating part of our industry. A beautiful cross roads between CS theory and practical application.
MLton? I've been playing around on-and-off with a non-production SML compiler and MLton is such a fantastic resource.
This is just a hobby for me, but I have read (and own) several different compiler textbooks. What I really want is one that focuses on compiling functional languages down to assembly.
During our code gen lectures, he had told us that MLtons original (not sure if it's still the default) backend generated C and shipped it over to a C compiler to do the dirty work. I know they have an official x86 backend now too though.
I wish I had resource recommendations for what you're looking for (because it is a super interesting topic), but hopefully MLton can serve as a great resource . PolyML may also be a good resource - not sure though.
For undergrad level PL, I highly recommend Dan Grossman's MOOC[0] or recent class recorded lectures[1]. Dan's thesis work strongly influenced Rust's borrow checker.
Disclosure: Dan advised me in undergrad and Adrian is a friend.
[0] https://www.coursera.org/learn/programming-languages
[1] https://courses.cs.washington.edu/courses/cse341/19sp/ (ctrl-f "Videos")
Me too. In my school, we had great introduction/mid-level classes but at the graduate level, I found our classes underwhelming. Mostly Prof/Researchers teaching their narrow specialties and trying to recruit PhD students, but without putting much time in their lectures as they didn't care about teaching. Bunch of slides, research papers to read. They wouldn't bother making a heavy programming project, which was left to their colleagues doing less research.
Fairly underwhelming. Lots of online resources to chase after to catch up to the state of the art, but a lot of the courses are things like the history of, and developments of, the technology. Worth knowing, but I don't need multiple, year-long adventures in this stuff -- get me to modern, and then let's solve some actual problems!
There's an awful lot of cult of the new that goes on in modern research.
While not research, it is nontheless interesting to watch every generation of programmers (including mine) re-discover RDBMS after tripping over all the pitfalls with the hot new stuff.
I've seen it like 2 years ago and it is well prepared course.
>CS 6120 is a PhD-level Cornell CS course by Adrian Sampson on programming language implementation.
I just dont understand why is this "PhD level"
It's really up to the professor.
It would have been if the papers covered were closer to the state of the art. The most recent one is from 2015.
However, this course would actually give you the background required to read more recent paper and work on compiler research, so calling it PhD level is not a huge stretch.
You are right when it comes to programming language design and somewhat wrong when it comes to compiler design.
If you are doing compiler research/development, you have to be familiar with the latest and greatest research because the margins for improving things are fairly slim. It’s usually fine to be not familiar with how things worked ~30 years ago.
For programming languages, you absolutely have to understand the foundations to do absolutely anything.
Someone doing compiler research this might be a first graduate level course to get them used to the technique and concepts used in more recent research for the might have two or three additional courses getting closer and closer to state of the art.
On the other hand, if the margins for improving compiler quality are slim they can be ignored without great consequences: it makes sense to study state of the art research only in the niches that turn out to be relevant for a specific need of a specific project, not blindly and at the expense of important general principles and techniques (i.e. mostly the problems of 75 years ago and the solutions of 25 years ago).
In that vein, it makes a lot more sense to focus on a solid, foundational paper than whatever incrementalism came out most recently. SLP vectorization is a good example here--yeah, the foundational paper is 20 years old at this point, but you'd rather students read and understand that than whatever the most recent addition to SLP vectorization came out in this (or last) year's PLDI. Even the other papers I think I might add or substitute for others in this course aren't going to be substantially newer than the stuff already here.
For example, they read and discuss papers rather than just working out of a textbook.
As more of a math course than a computer engineering course, 6120 was a first-semester Ph.D. level class, and I certainly wouldn't recommend taking it unless you really wanted to dive deep into the depths of programming language implementation. Incoming students were expected to be fluent in discrete mathematics and formal proofwriting skills. I wasn't, so I found myself falling behind at the start even though I had some familiarity with lambda calculus and algebraic datatypes. You definitely benefit from a strong math background.
HN gave me much better education in CS and programming than any traditional source.
Author has made complete draft PDFs for both the Racket and Python versions available here. https://wphomes.soic.indiana.edu/jsiek/
I tend to be biased towards what Jeremy Siek himself markets as "Proven in the classroom" when it comes to book authors in CS. Many book authors lack this experience and simply write for themselves, which is ok, but can result in bad didactics. Good teachers and authors from academia are invaluable.
I just wish textbooks didn't have their own bad tendencies: they have pablum as an attractor, because on average students just want to get through the class, not doing too much worse than average among the other students. Even without this problem, there's a more basic one: like with enterprise software, the decision to buy the book is not typically up to the user. "Will people actually want to read this on their own time?" is a strong driver of quality, even though it has pitfalls too.
Simple machine code generation with basic register allocation and evaluation which eagerly spills to the stack is not super hard. Producing fast code instead is a bottomless well.
I used what I learned from GCC output Then I wrote a basic amd64 expression compiler with simple live ranges and linear register allocation and ANF (a normal form) for postorder AST traversal for code generation. It can only evaluate nested add and mul expressions.
https://github.com/samsquire/compiler or on replit: https://replit.com/@Chronological/Compiler3#main.py
Finding opcodes is a struggle but there is this website: https://www.felixcloutier.com/x86/ and https://www.cs.uaf.edu/2016/fall/cs301/lecture/09_28_machine... (the table at the bottom is really useful)
To learn code generation not targeting amd64, I wrote an imaginary assembly language and then wrote a switch based virtual machine and a compiler for it with a frontend that looks similar to javascript.
https://github.com/samsquire/multiversion-concurrency-contro... in ProgramParser.java, LanguageInterpreter.java, and LanguageInterpreterRunner.java for where main() is.
You can find a PDF and the associated course with a very minimal amount of following links.
If you are thinking of making your own language, it's also good to learn something about programming language theory, if you don't already. Many languages make mistakes that have been solved 25+ years ago. PLAI is good for that: https://www.plai.org/
https://www.cs.cornell.edu/~asampson/blog/llvm.html
This is a great resource, I've wanted to learn how to use LLVM to compile to RISCV assembly for a while, e.g.
I’m not feeling any pressure or anything
Andy Pavlo's CMU 15-721: Advanced Database Systems is similar, where you will hack on Postgres to implement a Foreign Data Wrapper (FDW)
> The lecture slides used in the course are taken from Prof. Andy Pavlo's CMU 15-721 course
Just go to the source: https://15721.courses.cs.cmu.edu/spring2023/
SSA is functional programming (the paper) resonated with me, though I remain unconvinced by phi nodes relative to basic blocks taking arguments.
Well worth using as a resource.
Huh? Why would that be an important component?
I mean I know that it's typical for courses that come with credit, but in my mind it's just a side effect of the administrative side of providing courses, not something that's at all central to accreditation. I.e. if you build up the knowledge over a longer period (which you can still do with e.g. resits) that's completely fine as well.
Read any of the research on MOOCs and it becomes clear that we don’t have a clue how to write a self-paced course people finish with any regularity.
Seems rather ridiculous of Cornell to dictate terms for the University of My Imagination (UMI), if an imaginary professor at UMI wants to grade my work I think they should be allowed to do so and even grant me an imaginary degree if they feel I have earned it. Guess it is true, universities do stifle creativity.