Introduction to Compilers and Language Design

(a free online textbook by Douglas Thain)

This is an early preview of a textbook to be released later in 2017. You can read a sample chapter today.

This textbook will be 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 will be 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 (compilerbook.org) 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.

Book Cover Douglas Thain,
Introduction to Compilers and Language Design,
http://compilerbook.org, 1st edition, 2017.

Outline of the book:

Introduction to Compilers and Language Design
Chapter 1 Introduction
Chapter 2 Overview
Chapter 3 Scanning
Chapter 4 Parsing
Chapter 5 Parsing Expressions
Chapter 6 The Abstract Syntax Tree
Chapter 7 Typechecking
Chapter 8 Intermediate Representations
Chapter 9 Memory Organization
Chapter 10 Assembly Language
Chapter 11 Code Generation
Chapter 12 Optimization