Interactive Introduction to Compiler Construction

This book is a short introduction to compiler construction using JavaScript as the implementation language, recursive descent parsing with the EBNF parser generator and SLR(1) parsing with BNF as case studies for tools, and a little programming language with several extensions as working example. Here are the chapters:

1. Compiler Terminology

What's in a Compiler?
What's in a Parser Generator?

2. Writing Grammars

What's in a Rule?
A Language for Rules
Summary

3. Scanning Input

Terminals, Tokens, and Literals
Taking Input Apart
Summary

4. Recognizing Sentences

What's in a Sentence?
Check Before You Call!
Summary

5. Translating Sentences

What's in a Parse Tree?
What's with the Brackets?
Summary

6. Compiling Little Languages

Interpret Now, Compile for Later
Functions and a Stack Machine
Summary

7. Language Features

Type Checking
Functions, Scopes, and Nesting
Summary

8. Functions as Values

First-Order Functions
Stack versus Closure
Summary

9. Compiling Grammars

What's in a Parser Generator?
Grammar (De-)Constructed
Summary

10. Recognition Revisited

Try (Almost) Everything?
Conflicts and Errors
Summary

11. Compiling Revisited

What's in a Tree?
What's with a Tree?
Summary

A: The Practice Page

The Model
Scripting and Buttons Explained

B: The Stack Machine

Machine Architecture
Instructions

C: The One-Pass Compilers

The Method Browser
Rules and Actions
Symbol Table

D: The Compiler Kit

Tree Builders
Visitors

References

All references are links. Undecorated links are references within the book itself. Decorated links reference the book's website:

Other decorated links reference the World Wide Web:

  • For JavaScript information, links point to the excellent MDN Web Docs,
  • a few links point to specific web pages, such as the original announcement of JavaScript,
  • and terminology is linked to definitions in Wikipedia so that additional information is easily available — further references should be consulted from there.

Altogether, the book contains over 1100 unique links.

Previous: Book Cover Next: 1. Compiler Terminology