Skip to content

Stanford CS143: Compilers


  • Offered by: Stanford University
  • Prerequisite: Computer Architecture
  • Programming Languages: Java or C++
  • Difficulty: 🌟🌟🌟🌟🌟
  • Learning Hours: 150

This course aims to impart the principles of compiler construction for programming languages to students. The instructors have designed a “COOL language”, namely Class-Object-Oriented-Language. By study and practice, you will design and implement a compiler, which can translate the human-readable COOL language into machine-readable MIPS assembly which can be run on the SPIM emulator.

Following the Dragon Book, the theoretical part of the course covers lexical analysis, syntax analysis, semantics analysis, runtime environments, register allocation, optimization, and code generation. The practical part, accordingly, is divided into 4 steps: 3 for the frontend and 1 for the backend. The difficulty is considered gradual, increasing at a proper rate. Should you have enough time and interest even after completing all the required work, there’s a huge room left for you to do optimization.

Course Resources

Collection of Course Resources

@skyzluo has been maintaining a repo of course resources used and reference implementations of programming labs: skyzluo/CS143-Compilers-Stanford - GitHub.