Indiana University, Fall 2026
High-level programming languages like Racket and Python make it easier to program compared to low-level languages such as x86 assembly code. But how do high-level languages work? There’s a big gap between them and machine instructions for modern computers. In this class you learn how to translate Racket or Python programs (your choice!) all the way to x86 assembly language.
Traditionally, compiler courses teach one phase of the compiler at a time, such as parsing, semantic analysis, and register allocation. The problem with that approach is it is difficult to understand how the whole compiler fits together and why each phase is designed the way it is. Instead, each week we implement a progressively larger subset of the input language. The very first subset is a tiny language of integer arithmetic, and by the time we are done the language includes first-class functions.
Prerequisites: Fluency in Racket or Python is highly recommended as students will do a lot of programming in one of those languages. Prior knowledge of an assembly language helps, but is not required.
Textbook: Essentials of Compilation: An Incremental Approach in Racket/Python
The Racket version of the textbook for the course is available at the IU bookstore and from many book sellers, links to those here. The PDF is also available for free here.
The Python version of the textbook for the course is available at the IU bookstore and from many book sellers, links to those here. The PDF is also available for free here.
If you have suggestions for improvement, please either send an email to Jeremy or, even better, make edits to a branch of the book and perform a pull request. The book is at the following location on github:
https://github.com/IUCompilerCourse/Essentials-of-Compilation
Lecture: Tuesdays and Thursdays 2:20-3:35pm, Informatics Building (Myles Brand Hall), Room I 107.
Office Hours
Topics:
Instruction Selection
Register Allocation
Static type checking
Conditional control flow
Mutable data
Garbage collection
Procedures and calling conventions
First-class functions and closure conversion
Dynamic typing
Generics
Grading:
Course grades are based on the following items. For the weighting, see the Canvas panel on the right-hand side of this web page. Grading will take into account any technology problems that arrise, i.e., you won’t fail the class because your internet went out.
Assignments:
Organize into teams of 2-4 students. Assignments will be due bi-weekly on Tuesdays at 11:59pm. Teams that include one or more graduate students are required to complete one challenge exercise per assignment.
Assignment descriptions are posted on Canvas. Turn in your
assignments by submitting your code to the autograder. There is a
Racket and Python version of each assignment. Submit your compiler
file, either compiler.rkt or compiler.py depending on the language
you are using.
Assignments will be graded based on how many test cases they succeed on. Partial credit will be given for each “pass” of the compiler. Some of the tests are in the public support code (see Resources below). The testing will be done on a linux (ubuntu) machine. The testing will include both new tests and all of the tests from prior assignments.
You may request feedback on your assignments prior to the due date. Just submit your work to the autograder and send us email.
Students are responsible for understanding the entire assignment and all of the code that their team produces. The midterm and final exam are designed to test a student’s understanding of the assignments.
Students are free to discuss and get help on the assignments from anyone or anywhere. When posting questions on Slack, it is OK to post your code.
In contrast, for quizzes and exams, students are asked to work alone. The quizzes and exams are closed book.
Late Assignment Policy: Assignments may be turned in up to one week late with a penalty of 10%.
Slack Chat/Messaging:
Workspace (signup using your iu email address).
Schedule
| Day | Lecture Topic | Assignment Due |
|---|---|---|
| Aug. 25 | Introduction | |
| Aug. 27 | From Lvar to x86 | |
| Sep. 1 | Example Compilation from Lvar to x86 in Racket and Python | |
| Sep. 3 | Register Allocation, Introduction and Liveness | |
| Sep. 8 | Register Allocation: graph coloring | Integers and Variables due, submit in Racket or Python (see also, Racket challenge or Python challenge) |
| Sep. 10 | Code Review: Integers and Variables | |
| Sep. 15 | L_If language, type checking, and x86_If | Integers and Variables, late deadline |
| Sep. 17 | No class | |
| Sep. 22 | Conditionals and Explicate Control | Register Allocation, submit in Racket or Python (see also, Racket challenge or Python challenge) |
| Sep. 24 | Conditionals: Select Instr., Reg. Alloc., Opt. Jumps, Code Review: Register Allocation | |
| Sep. 29 | Loops and Dataflow Analysis | Register Allocation, late deadline |
| Oct. 1 | Loops: RCO, Explicate, Challenge | |
| Oct. 6 | Tuples and Garbage Collection | Booleans and Conditionals, submit in Racket or Python (see also, Racket challenge or Python challenge) |
| Oct. 8 | Static Single Assignment | |
| Oct. 13 | Code Review: Conditionals | |
| Oct. 15 | Tuples and GC, cont’d | Booleans and Conditionals, late deadline |
| Oct. 20 | Review for Midterm Exam | Loops, submit in Racket or Python (see also Racket challenge or Python challenge) |
| Oct. 22 | Midterm Exam in class |
Resources: