Hacker Courses The online courses programmers keep recommending, ranked from 20 years of public forum comments.
i
#96 overall

Compilers

Stanford Lagunita

4 recommenders · 5 threads · recommended in 3 years, 2017–2020 · score 4.8

Go to course ↗

A Stanford course on compiler construction taught by Alex Aiken, offered self-paced on Lagunita. It covers lexical analysis, parsing, semantic analysis and code generation, and students build a working compiler (for the COOL language, with assembly output run in an emulator).

Commenters call it free, self-paced and one of the best educational experiences, since you actually write a compiler.

Programming Languagesintermediatefreeself-paced text#compilers#parsing#code generation#semantic analysis#aiken#cool

Recommendations by year

20062026

What commenters said (7)

  1. Strongly recommendspulsarpietro2017in “Writing a C Compiler, Part 1”

    At uni I went through a module on compilers which basically covered all the Dragon book.

    I then followed this on-line course where you actually write a compiler for the COOL language. It has been one of the best educative things I've ever done in my life and I can't help recommending it.

    https://lagunita.stanford.edu/courses/Engineering/Compilers/...

    I'd love to do something like that in my professional career but unfortunately 90% of the time I ended up carrying out way less interesting work (writing application for end users).

  2. Recommendsxc4682020in “Parsing Algorithms”

    I recommend compilers course by Alex Aiken from Stanford open

  3. RecommendsPhilWright2019in “Ask HN: How to learn to write a compiler and interpreter?”

    You can get started on the compiler/interpreter specific learning as long as you already know a programming language and basic data structures. You do not need any math skills.

    1) Lexical Analysis (Tokeniser)

    The first step of your compiler takes in free form text and turns it into a set of tokens that make the rest of the process much easier. To understand this you should learn about Regular Expressions and Finite State Machines.

    2) Syntax Analysis (Parsing)

    Processing the above tokens and ensuring the input has the valid syntax of a program is your next step. You need to learn about Context Free Grammers, Backus Naur Form and Abstract Syntax Trees.

    3) Semantic Analysis

    Just because the input has valid syntax does not mean it makes actual sense. Here you need to learn about Symbol Tables and Type Checking. The specifics are very dependant on the actual language you are dealing with.

    4) Code Generation

    A compiler will be generating code but an interpreter will perform actual execution of the Abstract Syntax Tree operations. Again, the specifics are very dependant on the actual language you are dealing with and the target. Start by looking into Code Generation, Code Optimizations and Assembly Code.

    I recommend an online, free course, like the following from Stanford that is self-paced and results in a compiler that generates assembly level instructions for test running in an emulator.

    https://lagunita.stanford.edu/courses/Engineering/Compilers/...

  4. Recommendssn92017in “Ask HN: Resources for learning to write compilers?”

    You can take Stanford's Compilers course from Lagunita: https://lagunita.stanford.edu/courses/Engineering/Compilers/...

  5. Recommendssn92017in “Lessons learned building a toy compiler”

    You can take Stanford's Compilers course for free as an online course from Stanford's Lagunita.

  6. MentionsKMag2021in “Apple M1 Assembly Language Hello World”

    I'm currently auditing the Stanford compilers course online. I understand the inertia in introductory courses, and the simplicity of MIPS, but hopefully the course is eventually ported to Aarch64 or RISC-V. Presumably a spim-like simulator for Aarch64 or RISC-V is the biggest missing component.

    6.004 was one of my favorite classes at MIT, and the DEC Alpha AXP was a fine architecture to simplify for the pedagogical Beta architecture. However, I'm glad to hear they've moved to RISC-V. I presume they'd been avoiding porting the course to Aarch64 (or a simplified version thereof) due to intellectual property issues.

  7. Mentionsdkersten2010in “Ask HN: College without college (idea)”

    Interestingly enough, a lot of universities do have the course material available on their websites. Eg, I learned most of my compiler module from Stanford course notes because they were better than my own lecturers ones.

    But I get what you're saying and imagine this is why not all universities do this. If everything were free, they may not get so many people paying for it.

Related courses

Keyboard

In the course grid
←↑→↓
Move between courses
Home End
Start / end of row (with Ctrl: first / last)
PgUp PgDn
Jump several rows
Enter
Open course
S
Save / unsave course
1–5
Best, Trending, Hidden gems, Evergreen, Saved
[ ]
Previous / next topic
On a course page
← →
Previous / next course in your list
S
Save / unsave
O
Open the course website
Esc
Back to the grid
Everywhere
/
Search
T
Light / dark theme
?
This help