This is an archive of lab answers of the course Compiler. The final compiler has both front-end and back-end, and aims at x86 platform.
ComMouse
- Lab 1: Straight-line program interpreter (Chapter 1)
- Lab 2: Lexical Analysis (Chapter 2)
- Lab 3: Syntax Analysis (Chapter 3,4)
- Lab 4: Type Checking (Chapter 5)
- Lab 5: Intermediate Code (Chapter 6,7)
- Lab 6 (part A): Instruction Selection (Chapter 9)
- Lab 6 (part B): Making It Work (Chapter 10,11,12)
Please follow the instructions in each lab. Lab instructions can be found on the history pages of the course website. All the Labs are based on the Tiger book. The final compiler is in Lab 6 (part B).
Note that this is not a perfect compiler implementation. A lot of bugs and shortage may occur. You may report or try to fix them if you are willing to.
In addition, the code style in these projects is both naive and ugly (FP & OOP style in C)... Hope you can bare this...
Copycats can be detected so please do not copy here.
- Original Code: Follow the license in each lab.
- Modified Code: MIT License