Introduction to Compilers and Language Design

(a free online textbook by Douglas Thain)

Update: The final chapters of this online textbook are now complete. After some final editing stages, the complete book will be available for purchase in 2018.

This textbook is suitable for a one semester undergraduate course in compilers. Guided by this book, students can undertake construction of a compiler which accepts a C-like language and produces working X86 code. 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.

You are free to download, use, and print these PDFs for personal and academic use. Commercial printing or distribution is prohibited. Instead of copying PDFs, please point students to this page ( so that they can access the latest version. If you enjoy holding a physical book (like I do!) you will be able to order an inexpensive hardcover edition in 2018.

Book Cover Douglas Thain,
Introduction to Compilers and Language Design,, 1st edition, 2018.

Outline of the book:

Introduction to Compilers and Language Design
Front Matter
Chapter 1 Introduction
Chapter 2 A Quick Tour
Chapter 3 Scanning
Chapter 4 Parsing
Chapter 5 Practical Parsing
Chapter 6 The Abstract Syntax Tree
Chapter 7 Semantic Analysis
Chapter 8 Intermediate Representations
Chapter 9 Memory Organization
Chapter 10 Assembly Language
Chapter 11 Code Generation
Chapter 12 Optimization
Appendix A Sample Course Project
Appendix B The C-Minor Language
Appendix C Coding Conventions