Skip to content

# SJTU Compiler Principles

## Course Introduction

- Offered by: Shanghai Jiao Tong University
- Prerequisites: Basic Computer Systems, Data Structures and Algorithms, Programming Fundamentals
- Programming Language: C++
- Course Difficulty: 🌟🌟🌟🌟
- Class Hour: 150 hours

The Compiler Principles course at Shanghai Jiao Tong University aims to implement a compiler for the Tiger language. In this course, you will learn about lexical analysis, grammar analysis, semantic analysis, escape analysis, activation records (stack frames), LLVM IR, liveness analysis, register allocation, garbage collection, object-oriented programming, functional programming, and many other topics. Similar to the Compiler Principles course at Peking University, this course offers you a great deal of freedom. The test programs will only check the correctness of the assembly code you output and will not impose any restrictions on the specific design of your compiler. You will need to build your own compiler step by step from scratch.

In this course, you will learn how to use frameworks such as `Flex`, `Bison`, and `LLVM`, and enhance your debugging skills through practice. The theoretical part of the course is taught by teachers from the IPADS Laboratory at Shanghai Jiao Tong University.

## Course Resources

- Course Website: https://ipads.se.sjtu.edu.cn/courses/compilers
- Slides: https://ipads.se.sjtu.edu.cn/courses/compilers/Schedule.html
- Framework Code: Not yet open-sourced. Old version: https://gitee.com/east-china-normal-university_ttb_cs/tiger-compiler-25sp; For the newest version, please contact to the TA.
- Course Textbook: "Tiger Book" (Modern Compiler Implementation in C) https://ipads.se.sjtu.edu.cn/courses/compilers/textbook/TigerBook-English.pdf
- 2 Quizzes + 5 essential labs + 2 optional labs
  - Lab 1: Straight-line Program Interpreter
  - Lab 2: Lexer
  - Lab 3: Parser
  - Lab 4: Type Checking
  - Lab 5
    - Part 1: Escape Analysis
    - Part 2: Translate to LLVM
  - (Optional) Lab 6: Code Generation
  - (Optional) Lab 7: Register Allocation

2026-01-18