Resources
Here are some supplemental resources that may be helpful on this course and for going beyond this course.
Books
- Compilers: Principles, Techniques, and Tools — A highly regarded classic that explains the theory and practice behind each compiler stage clearly and in detail, and teaches many optimization techniques. Works well as a reference.
- Types and Programming Languages — An excellent introduction to type systems, including type inference, subtyping, generics, existentials and more, as well as how these features interact and how to formally prove various properties of type systems. Extremely helpful for properly understanding the space of type-related language design decisions.
- Programming Language Pragmatics — provides a high-level overview about the design of programming languages, different language paradigms, and compiler construction. Unlike the dragon book, this is not a detailed compiler construction manual.
- Crafting Interpreters (has free version) — an approachable tutorial on building a tokenizer, parser and interpreter. Shows both an AST-based interpreter as well as a more performant IR-based interpreter.
x86-64 assembly programming
- Stanford CS107 slides provide an excellent introduction: lecture 15, lecture 16, lecture 17, lecture 18
- Introduction to the GNU Assembler is a compact tutorial for writing and running Assembly code on a Linux machine, and interfacing with C code.
- Compiler Explorer turns your C/C++ code into Assembly code. Excellent for answering ”how do I write this in Assembly?” questions.
- To see assembly code in AT&T syntax, click on the gear icon and deselect ”Intel syntax”.
- To see a more compact but sometimes more confusing / ”clever” translation, add
-O2
to ”Compiler options” to enable optimizations.
- Short summary of registers (instruction table uses Intel argument order)
- x86-64 reference (detailed and technical, uses Intel argument order)
- System V ABI (Linux calling convention)
- Linux system call reference