Introduction to Compilers and Language Design
TL;DR · AI 摘要
本书系统讲解编译器构建全流程,涵盖从词法分析到代码优化的12个核心章节,适合具备C语言基础的本科生学习实践。
核心要点
- 编译器构建包含扫描、解析、AST生成等12个核心阶段
- 书籍提供完整课程项目和B-Minor语言示例代码
- 可通过compilerbook.org获取最新PDF版本
结构提纲
按章节快速跳转。
思维导图
用一张图看清主题之间的关系。
查看大纲文本(无障碍 / 无 JS 友好)
- 编译器与语言设计
- 书籍结构
- 12个核心章节
- 附录项目
- 技术内容
- 词法分析
- 代码优化
- 资源获取
- PDF下载
- 纸质书购买
金句 / Highlights
值得收藏与分享的关键句。
构建编译器是计算机科学学生的必经实践,融合理论与工程实现
本书配套GitHub仓库包含扫描器、解析器等完整实现示例
第二版修订日期为2021年1月15日,包含最新教学改进
Introduction to Compilers and Language Design | Prof. Douglas Thain at Notre Dame
Prof. Douglas Thain at Notre Dame
|
About
Teaching
Research
Papers
Talks
Service
Blog
Lab
Introduction to Compilers and Language Design
This is a free online textbook: you are welcome to access the chapter PDFs directly below. If you prefer to hold a real book, you can also purchase a hardcover or paperback below. The textbook and materials have been developed by Prof. Douglas Thain as part of the CSE 40243 compilers class at the University of Notre Dame. Join our mailing list to receive occasional announcements of new editions and other updates.
A compiler translates a program written in a high level language into a program written in a lower level language. For students of computer science, building a compiler from scratch is a rite of passage: a challenging and fun project that offers insight into many different aspects of computer science, some deeply theoretical, and others highly practical. This book offers a one semester introduction into compiler construction, enabling the reader to build a simple compiler that accepts a C-like language and translates it into working X86 or ARM assembly language. It is most suitable for undergraduate students who have some experience programming in C, and have taken courses in data structures and computer architecture.
Douglas Thain, Introduction to Compilers and Language Design , 2nd edition, 2020. (Revision Date: January 15, 2021) http://compilerbook.org
Paperback ISBN: 979-8-655-18026-0
Buy Paperback via Amazon
Introduction to Compilers and Language Design, 2nd Edition
The author grants permission to download, print, and use these PDFs for personal and academic use. Commercial printing or distribution is prohibited. Instead of copying PDFs locally, please point students to this page (compilerbook.org) so that they can access the latest version.
Complete Book
Single PDF Download
Chapter 0
Front Matter
Chapter 1
Introduction
Chapter 2
A Quick Tour
Chapter 3
Scanning
Chapter 4
Parsing
Chapter 5
Parsing in Practice
Chapter 6
The Abstract Syntax Tree
Chapter 7
Semantic Analysis
Chapter 8
Intermediate Representation
Chapter 9
Memory Organization
Chapter 10
Assembly Language
Chapter 11
Code Generation
Chapter 12
Optimization
Appendix A
Sample Course Project
Appendix B
The B-Minor Language
Appendix C
Coding Conventions
Code Resources. The compilerbook-examples github repository contains additional resources that correspond to the book, including several scanners and parsers, a starter code structure for the project compiler, and sample test cases for each stage of the scanner, parser, typechecker, and code generator.
Errata. Found a typo or mistake? Please send an email to the author dthain@nd.edu with the title "Compiler Book Errata" and I'll be happy to correct it and acknowledge you in the next edition.
[if !IE]><script>fixScale(document);</script><![endif]