Modern Compiler Implementation in ML

©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 29. Program 2.9, at the end of the line digits=[0-9]+ there should be semicolon. Also, the last rule is missing a regular expression, which should be a dot.

Page 31. At the end of the line %s COMMENT there should be a semicolon. In the last rule, the semicolon should be outside the parentheses.

Page 53. 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 54. 7th line from bottom: TIMES should not be in argument of skipto.

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

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

Page 95. On line 9 (beginning with %nonterm), each time of exp or of stm appears, it should be of Absyn.exp or of Absyn.stm, respectively.

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

Page 116. 10th line from the bottom, exp=(), ty=Types.INT)) should be
{exp=(), ty=Types.INT})).

Page 118. Line 17, [{name,ty}] should be [{name,ty,pos}].

Page 137. 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 144. Line 6 should refer to $TIGER/chap7, not $TIGER/chap6.

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

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

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

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

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

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

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

Page 262. Figure 12.1, line 15 should refer to Temp.label, not Tree.label.

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

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

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

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

Page 434. 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 435. 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 447. Line 2, first occurrence of i should be i1

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

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

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