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.
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.
Paperback ISBN: 979-8-655-18026-0
Hardcover ISBN: 978-0-359-13804-3
|A Quick Tour
|Parsing in Practice
|The Abstract Syntax Tree
|Sample Course Project
|The B-Minor Language
edu with the title "Compiler Book Errata" and I'll be happy to correct it and acknowledge you in the next edition.