Source Language: C0
The labs use increasingly more complete subsets of the C0 programming language that has been designed for 15-122 Principles of Imperative Computation, a freshman-level course at Carnegie Mellon University. C0 is a small safe subset of C with an unambiguous semantics. You are strongly encouraged to learn C0, since you will be writing a compiler for this language.
Target Languages and Tools
x86-64 Machine-Level Programming
The following documents will help you fathom the depths of machine-level programming on x86-64 machines.
- x86-64 Machine-Level Programming This document supplements Chapter 3 the textbook for 15-213 Computer Systems: A Programmer’s Perspective, 3rd edition, by Randal E. Bryant and David R. O’Hallaron.
- GNU Assembler User Guide. This is version (2.15) available on the lab machines. Contains i386-specific features with notes on the difference between x86 and x86-64.
- x86-64 Application Binary Interface (ABI) Specifies the rules for compilers and linkers.
- Official Intel Processor Manuals (not for the faint of heart) including the Combined Set Reference.
IA32 and Reference Material
The following are for the older Intel x86 architectures. See the newer references above for the x86-64 (also known as IA32-EM64T).
- Intel opcode table for IA32, two-page reference
LLVM is a potential second target for the compiler for Lab 6.
Writing a garbage collector for C0 is one of the interesting options for Lab 6.
- Richard Jones’ Garbage Collection Page
- Paul R. Wilson: Uniprocessor Garbage Collection Techniques, 67pp, 1994
The distributed version-control system we use.
You are free to write your compilers in any language you choose. We strongly suggest choosing a statically typed language with algebraic data types and pattern matching. The course staff can provide support for the following languages: OCaml, Rust, and C++. Students with sufficient background and motivation are welcome to choose other languages.
- Standard ML of New Jersey (SML/NJ)
- MLton, A highly optimizing, whole program compiler mostly compatible with SML/NJ
- Poly/ML, Another high quality compiler
Standard ML Libraries and Documentation
- Haskell books and tutorials
- Parsec: monadic parser combinator library for Haskell
- Happy: parser generator for Haskell
- Java API
- JLex: lexer generator
- JFLex: lexer generator
- CUP: LALR parser generator
- ANTLR: lexer and LL parser generator
For Fall 2018 we strongly discourage the use of Scala due to efficiency issues.
Prior Course Instances
- Compiler Design, Fall 2020
- Compiler Design, Fall 2019
- Compiler Design, Fall 2018
- Compiler Design, Fall 2017
- Compiler Design, Fall 2016
- Compiler Design, Fall 2015
- Compiler Design, Fall 2014
- Compiler Design, Fall 2013
- Compiler Design, Fall 2012
- Compiler Design, Fall 2011
- Compiler Design, Fall 2010
- Compiler Design, Fall 2009
- Compiler Design, Fall 2008
- Compiler Design, Fall 2007