01Chapter 1: Where lexing, parsing, and translation fit in a compilerAssume you know regular expressions, finite automata, context-free grammars, parse trees, stacks, and basic recursion. This chapter uses “front end” for the compiler stages that analyze source text before target-machine code is generated.2 min read
02Chapter 2: Specifying tokens with regular expressionsThis chapter assumes you know basic regular languages and finite automata. You will use regular expressions to describe the token classes recognized by a lexical analyzer.1 min read
03Chapter 3: NFAs and DFAs as token recognizersAssume you know regular expressions, basic finite automata, sets, and transitions. This chapter treats an automaton as a recognizer: it reads an input string and decides whether the string belongs to a language. In a compiler, that language is usually the set of lexemes for one token class.2 min read
04Chapter 4: From regular expression to NFA to DFAAssume you know basic regular expressions, finite automata, sets, and graph traversal. This chapter shows how a token pattern becomes an automaton that a lexer can run.1 min read
05Chapter 5: Building a lexer: maximal munch, rule priority, and lexical errorsThis chapter assumes you know regular expressions, finite automata, sets, and basic recursion. A lexical analyzer, or lexer, reads characters and produces tokens. A token is a category and its text, such as ("NUM", "12") or ("ID", "total").1 min read
06Chapter 6: Leftmost and rightmost derivations and parse treesAssume you know context-free grammars, terminals, nonterminals, and the idea of a production. This chapter shows how a grammar generates a string and how to represent that generation as a parse tree. These ideas are useful when checking ambiguity and tracing parsers.2 min read
07Chapter 7: Ambiguity and how to resolve itAssume you know context-free grammars, derivations, parse trees, and basic predictive parsing. This chapter focuses on recognizing when a grammar gives more than one structure to the same input and on changing the grammar or parser rules to remove that uncertainty.2 min read
08Chapter 8: Removing left recursion and left factoringAssume you know context-free grammars, derivations, parse trees, and the basic idea of predictive parsing. This chapter prepares a grammar for top-down parsing, especially LL(1) parsing.2 min read
09Chapter 9: Computing FIRST and FOLLOWAssume you know context-free grammars, production rules, sets, and ε, which means the empty string. FIRST and FOLLOW sets help a predictive parser choose the correct production using the next input token.2 min read
10Chapter 10: LL(1) grammars and predictive parsing tablesAssume you know context-free grammars, derivations, parse trees, and set notation. An LL(1) parser reads input from Left to right, constructs a Leftmost derivation, and uses one lookahead token. Its predictive parsing table chooses the production without backtracking.2 min read
11Chapter 11: Recursive descent parsersAssume you know context-free grammars, parse trees, stacks, and recursion. This chapter uses the expression grammar:2 min read
12Chapter 12: LR(0) item sets and SLR(1) tablesAssume you know context-free grammars, derivations, sets, and stack-based parsing. This chapter develops the working method for constructing LR(0) item sets and an SLR(1) parsing table.1 min read
13Chapter 13: CLR(1) and LALR(1) parsersAssume you know LR(0) items, closure, goto, and SLR(1) parsing tables. CLR(1) and LALR(1) parsers improve LR parsing by attaching more precise lookahead information to items.2 min read
14Chapter 14: Conflicts and the power hierarchy of parsersThis chapter assumes you know context-free grammars, FIRST and FOLLOW sets, stacks, and the basic shift-reduce process. A parser conflict means that its parsing table gives more than one valid action for the same parser state and next input token. Conflicts usually indicate that the parser has insuf2 min read
15Chapter 15: Operator precedence parsingAssume you know context-free grammars, stacks, parse trees, and basic shift-reduce parsing. This chapter connects operator precedence decisions with practical error handling and semantic evaluation.2 min read
16Chapter 16: Dependency graphs, S-attributed and L-attributed definitionsThis chapter assumes that you know context-free grammars, parse trees, recursion, and basic set notation. You should also know that a grammar production describes structure, while semantic rules attach meaning to that structure.2 min read
17Chapter 17: Syntax-directed translation schemes and semantic action placementAssume you know context-free grammars, parse trees, and basic parsing. This chapter uses those ideas to attach actions to grammar rules. A syntax-directed translation scheme (SDT) is a grammar whose right-hand sides contain executable semantic actions. The parser performs an action when it reach2 min read