We try to keep our books accurate, but sometimes mistakes creep in. This page lists the errors submitted by our astute readers. If you've found a new error, please submit it.

The latest version of the book is P2.0, released 12 months ago. If you've bought a PDF of the book and would like to upgrade it to this version (for free), visit your home page.

Key: Typo Tech. Error Suggestion Not a problem Next edition

By default this page displays the errata for the latest version of the book. If you have a previous version, select it here:  

(To find out what version you have, look at the copyright page, a few pages in from the front of the book. If it says (say) 'Second Printing', then here it'll be P2.0. If there are interim PDF releases in that printing, they'll be 2.1, 2.2, and so on.)

PDF Paper Description Found in Fixed in
10

#32343: All three lines of the export statement should be bold; as is,
the second and third line look like output.--David Matuszek

P2.0
30
#29872: The reader is told to type an end-of-file character but the footnote explaining how to type the end-of-file character doesn't appear till page...more...
P2.0
33
#30949: The example of a program that consumes all characters: file : .+ ; throws a "Lexer is null" exception when run in the ANTLRworks interpr...more...
P1.0
44

#31245: Minor typo on 2nd paragraph, first line:

"ambiguous sentence or phase"

I think that should be "phrase".

--David Lee

P2.0
49
#29899: middle of page: You could say that the file has no structure or that the structure is simply “one or more characters.” Should be “zero or ...more...
P2.0
55
#29978: In the upper half of the page, a source code sample is given. There is stated that a grammer such as: multExpr returns [int value] will ...more...
P1.0
61

#29385: On the second line of the comments in Expr.g, there are extra spaces in the $stat.tree.toStringTree() call right before toStringTree.--Dan S.

P1.0
61
#30463: The tree printing code throws a NullPointerException woth an empty expression line, buttoken NEWLINE is a valid expr. prog :(stat {System.o...more...
P1.0
62
#29966: The instruction to compile Test.java, ExprParser.java and ExprLexer.java fails when using the code as distributed from this site, thus: Tes...more...
P1.0
67
#29405: After the testing the expression recognizer, the text says "ANTLR doesn't emit any output because there are no actions and grammar". There is...more...
P2.0
77
#29384: In the Literals section, the "one-character string containing the single quote character" is missing the closing single quote. I.e. it is show...more...
P1.0
83

#31044: The last sentence on the page is not visible due to the blue border.

P2.0
83

#29773: Last sentence in Fig 4.2 reads "Rule r should must a single node, not a subtree." Maybe it should be "should return a single node, ..." ? --Dean Jones

P1.0
93
#29414: The description of Actions says "to get the close curly character, escape it with a backslash". But there are many examples in the book that ...more...
P2.0
109
#29382: "Lexer rules can force the lexer to emit more token" should be "Lexer rules can force the lexer to emit more than one token". Also, you probab...more...
P1.0
123
#29412: "There are two tokens in this case:" is followed by a list of three tokens with types 4, 5, and 6. One is a literal '+', but isn't that still...more...
P2.0
125
#33176: "This is a good way to distinguish between local variables and fields of a class definition, for example." I'd say it is a way, but not re...more...
P2.0
127
#29413: The first sentence about the ASTLabelType option contains "all node variables pointers", which doesn't look right. Shouldn't it be "all node ...more...
P2.0
135
#31561: In the generated code for a(), the "System.out.println("exiting");" line should actually be "System.out.println("after matching rule; before f...more...
P2.0
138
#29415: "Any rule invoked from the methodDefinition rule can use the boolean instance variable inMethod to test...". I don't think this is explained ...more...
P2.0
160 147
#32415: This is a minor point, but in the paragraph discussing $ruleRef, I think the references to "$rulename" and "rulename" should be updated to "$r...more...
P2.0
168
#29381: On page 181 of the PDF and page 168 of the dead-tree version, we have: variableDefinition : modifiers type ID ('=' expression)? ';' -> {i...more...
P2.0
182

#29422: The rewrite rule for forStat doesn't reference the statement list slist. It should probably do that, right?--A Rooks

P2.0
206
#29423: The first paragraph of Chap 9 contains "from an internal data structures". The cardinalities are mismatched :-) It should say "an internal d...more...
P2.0
209

#29424: The last paragraph of section 9.1 has a subject/verb mismatch: it should say "Isolating [...] makes sense" instead of "make sense".--A Rooks

P2.0
215
#29927: The code on Page 215 (Paper) for "expr" has a return value (returns [int value]) which doesn't seem to be necessary, maybe it's a copy-paste e...more...
P1.0
247
#29459: The lead-in to the example says "override two methods from BaseRecognizer, displayRecognitionError( ) and getTokenErrorDisplay( )". However, ...more...
P2.0
247

#29460: There is no space separating the second sentence in section 10.3 from the first sentence. It says "... grammar.For ...".--A Rooks

P2.0
252

#29461: The comment in the code says "catch-clauses get replace with this action". That should be "replaced".--A Rooks

P2.0
267

#30707: "MATCh" in the first chunk of code should be "MATCH".

P2.0
268
#29534: This page uses "DFA" for the plural of "DFA" several times (I count 5 times). While I realize that the plural of "automaton" is "automata" an...more...
P2.0
270
#29533: At the bottom of the page when explaining the big DFA that does the lookahead for the embedded subrule of interfaceDef, the text says that DFA...more...
P2.0
310

#31040: While this is not germane to the ANTLR point discussed there, List<List<int>> is not valid Java and should probably read List<List<Integer>>.--Olivier Lefevre

P2.0
311

#31038: "backtracking=true" should read "backtrack=true"--Olivier Lefevre

P2.0
315
#29532: The paragraph beginning "The beauty of this solution is that a syntactic predicates handles ..." contains a typo. It should say "a syntactic ...more...
P2.0
320

#29535: The second paragraph begins with "lThis" which should just be "This".--A Rooks

P2.0
320

#29536: The third paragraph say "unless the uncovered alternatives is last". That should be singular "alternative".--A Rooks

P2.0
333
#32438: In the anecdote box at the top of the page: """ “That ’;’ came as a complete surprise to me at this point your program.” """ Should be...more...
P2.0
349

#31039: "backtracking=true" (twice) should read "backtrack=true"--Olivier Lefevre

P2.0