Modern Compiler Implementation in Java

©1998 by Andrew W. Appel

Errors in the first edition, 1999 printing:

This printing may be identified by the line "Reprinted with corrections, 1999" on page iv.

Page 20. Figure 2.2, second-to-last line should not have double quotes around \n and \t:
("--"[a-z]*\n)|(" "|\n|\t)+ { /* do nothing */ }

Page 31. Program 2.9, second-to-last line should not have double quotes around \n and \t:
("--"[a-z]*\n)|(" "|\n|\t)+ {}

Page 55. After the sentence, "The resulting productions will not pose a problem for a predictive parser" add:
Although the grammar is still ambiguous -- the parsing table has two entries for the same slot -- we can resolve the ambiguity by using the "else S" action.

Page 57. First line: TIMES should not be in Tprime_follow.

Page 66. First line of left-hand box: change ampersand (&) to $.

Page 79. Lines 11-12 should read,
3. Discard input symbols (if necessary) until a lookahead is reached that has a non-error action in the current state.

Page 83. Line 15, tiger.grm should be Grm.cup.

Page 104. The Tiger program shown is actually illegal, since g is declared to return no value but its body returns the value f().

Page 118.
9th line from bottom, "enventry" should be "Entry".
3rd line from bottom, "UNIT" should be "VOID".

Page 119. Figure 5.8, lines 3 and 4 should read,
Symbol.Table venv; // value environment
Symbol.Table tenv; // type environment

Page 120. 7th and 8th lines after figure should read,
Translate.Exp transDec(Absyn.Exp e) { ... }
Types.Type transTy(Absyn.Ty e) { ... }
5th line from bottom and 4th line from bottom should refer to Types.Type, not just Type.

Page 121. line 4 should read,
public abstract class Exp {}

Page 128. Exercise 5.1 (b) should read, "Explain how the object-oriented implementation of HashT allows several different tables to be in use simultaneously."

Page 143. Table 6.4. The MIPS column of the table uses registers r2, r4, r5 for passing parameters. The use of r2 for the "zeroth parameter" is consistent with the MIPS convention of passing the static link in r2; the argument x1, by this point in the compilation, is really the static link.

Page 183. 7th line from bottom, change "whether two expressions commute" to "whether a statement commutes with an expression".

Page 226. Table 10.5 in the 4th iteration, the out set for statement 3 is c, when it should be b.

Page 245. Assignment statements on line 19 should say,
t:=M[bloc]; M[aloc]:=t.

Page 247. Figure 11.7, captions (a) and (b) are missing.

Page 249. Last sentence, swap "afterward" and "beforehand".

Page 252. Delete last bullet item entirely ("When u is coalesced ...").

Page 258. Line 8, change all three occurrences of "nodeMoves" to "moveList".
Insert new line, "EnableMoves(v)".

Page 281. Algorithm 13.5, after second line, insert:
mark x

Page 376. 8th line from bottom, delete the word "not".

Page 438. 11th line from bottom, change "block 1 and block 2" to "block 1 and block 3".

Page 439. FIGURE 19.3 (b), the assignment c1 <- c1 + b2 should be c1 <- c2 + b2

Page 444. Line 2: "that are not dominated by" should be "that are not strictly dominated by"
Line 22: "if n does not dominate w" should be "if n does not dominate w, or if n = w"

Page 445. Algorithm 19.6, line 10 should read,
if a not in Aphi[Y]
Algorithm 19.6, line 14 should read,
Aphi[Y] <- Aphi[Y] u {a}.

Page 457. Line 2, first occurrence of i should be i1

Page 460. Line 6, change "10" to "1".

Page 499. Exercise 20.2g, "Run Algorithm itermod" should be "Run Algorithm 20.9".

Page 529. 4th line from bottom, change both occurrences of "integer" to "int".