Skip to content
HN On Hacker News ↗

Introduction to Compilers and Language Design

▲ 305 points 50 comments by AlexeyBrin 1d ago HN discussion ↗

Pangram verdict · v3.3

We believe that this document is fully human-written

0 %

AI likelihood · overall

Human
100% human-written 0% AI-generated
SEGMENTS · HUMAN 2 of 2
SEGMENTS · AI 0 of 2
WORD COUNT 389
PEAK AI % 0% · §1
Analyzed
Jul 5
backend: pangram/v3.3
Segments scanned
2 windows
avg 195 words each
Distribution
100 / 0%
human / AI fraction
Verdict
Human
Pangram v3.3

Article text · 389 words · 2 segments analyzed

Human AI-generated
§1 Human · 0%

Prof. Douglas Thain at Notre Dame

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.

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.

§2 Human · 0%

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.