Stanford CS143: Compilers
课程简介
- 所属大学:Stanford
- 先修要求:计算机体系结构
- 编程语言:Java 或 C++
- 课程难度:🌟🌟🌟🌟🌟
- 预计学时:150 小时
斯坦福的编译原理课程,设计者开发了一个 Class-Object-Oriented-Language,简称 COOL 语言。这门课的核心就是通过理论知识的学习,为 COOL 语言实现一个编译器,将 COOL 高级语言编译为 MIPS 汇编并在 Spim 这个 MIPS 模拟器上成功执行。
理论部分基本按照龙书的顺序覆盖了词法分析、语法分析、语义分析、运行时环境、寄存器分配、代码优化与生成等内容,实践部分则相应地分为词法分析、语法分析、语义分析、代码生成四个阶段,难度循序渐进,并在优化部分给学生留下了很大的设计空间。
课程资源
- 课程网站:http://web.stanford.edu/class/cs143/
- 课程视频:https://www.bilibili.com/video/BV17K4y147Bz
- 课程教材:龙书
- 课程作业:5 个书面作业 + 5 个编程作业带你实现一个编译器
资源汇总
@skyzluo 在学习这门课中用到的所有资源和作业实现都汇总在 skyzluo/CS143-Compilers-Stanford - GitHub 中。
Stanford CS143: Compilers
Descriptions
- 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
- Course Website: http://web.stanford.edu/class/cs143/
- Recordings: https://www.bilibili.com/video/BV17K4y147Bz
- Textbook: Compilers: Principles, Techniques and Tools (Dragon Book)
- Assignments: 5 written assignments + 5 programming labs
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.