Important Dates
- Lab 1 (5%): September 14 - September 27 (2 weeks) (due October 5)
- Lab 2 (5%): September 28 - October 11 (2 weeks) (due
October 18 October 25)
- Lab 3 (10%): October 12 - November 1 (3 weeks) (due
November 8 November 12 November 16)
- Lab 4 (20%): November 2 - November 30 (4 weeks) (due
December 6 December 10 December 9)
As you can see, the bulk of the credit is in lab 4;
labs 1-2 are particularly straightforward, and should not require more than a week each.
Lab 4 is also where the most interesting and valuable stuff happens.
Therefore, while these are the official deadlines,
we recommend that you work ahead so you have more time for Lab 4.
Lab Description
You will be building a compiler for a (small) subset of C.
You will learn about lexers through Flex,
LR parsers through GNU Bison,
and SSA/code generation through LLVM.
The starter code and labs try to be general rather than ad-hoc,
so you should be able to easily extend your compiler to handle new language features as you desire.
Throughout this lab, depending on how much you choose to do,
you will learn about and gain experience with many skills,
including ones beyond the scope of compiler construction:
- compiling open source software such as LLVM, GNU Bison, and even GCC,
- using CMake, one of, if not the most popular build tool for C++,
- reading extensive documentation,
- lexical analysis, and how to use a lexer generator such as Flex,
- context-free grammars, (bottom-up LR) parsing, and how to use a parser generator such as GNU Bison,
- building ASTs and analyzing them,
- reading research papers,
- producing a control-flow graph in SSA form using the techniques described in Simple and Efficient Construction of Single Static Assignment Form, by Braun et al.,
- using LLVM, an industry-tested compiler infrastructure project used by Clang, Rust(c), and many other compilers,
- and simple optimization techniques used by compilers.
As stated previously, these labs is designed so that you may continue to build on it;
it is not a completely arbitrary assignment without much practical use.
Therefore, the amount you can learn from it is bounded only by your own time and effort.
I hope we have made these labs interesting and enjoyable for you.