small medium large xlarge

Errata for The Definitive ANTLR 4 Reference

 

The latest version of the book is P2.0, released over 1 year 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.

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

If you've found a new error, please submit it.

  • Typo
  • Tech. error
  • Suggestion
  • Maybe next edition
  • Not a problem
  • Reported in: P2.0 (28-May-15)
#78452
Paper page: 5
The Windows commands to run ANTLR on this page are not correct. Below I have some example commands that I've tested in Windows. I kept the paths the...more...
  • Reported in: P2.0 (11-Dec-15)
#79326
PDF page: 6
Configuration: 1. Page 6 in PDF. 2. antlr-4.5.1-complete.jar 3. ubuntu 14.04 machine Scenario: When trying to run 'grun Hello r -tokens' comman...more...
  • Reported in: P2.0 (09-Jan-15)
#78028
PDF page: 36
Throughout the book, cross-reference links to other pages are missing a space between the comma and the words "on page NN". Presumably, this is a mist...more...
  • Reported in: P2.0 (28-May-15)
#78453
Paper page: 39
I found that you cannot have a label on a rule containing a single condition (no alternatives). I found that it's helpful for debugging purposes to u...more...
  • Reported in: P2.0 (29-Dec-14)
#77986
PDF page: 40

The source for tour/EvalVisitor.java is no longer valid for Antlr 4.4. Where are the modified sources?

  • Reported in: P1.0 (12-Sep-14)
#77316
PDF page: 49
In the tour/Data.g4 example, there's the following piece of code: sequence[int n] locals [int i = 1;] : ( {$i<=$n}? INT {$i++;} )* // match n int...more...
  • Reported in: P2.0 (19-Sep-14)
#77387
PDF page: 49
Hi, I am using Antlr4.4. I have adapted the example tour/Data.g4 as follows: sequence[int n] locals [int i = 42;] : ( {$i < $n}? INT { Sys...more...
  • Reported in: P2.0 (29-Dec-14)
#77988
PDF page: 52

“mode” should be purple-boldfaced to represent it as a keyword.--Ravi Ponamgi

  • Reported in: P2.0 (16-Feb-15)
#78190
PDF page: 59
Ultimately, we need the ability to divine a language’s structure from a set of representative input files. There is a difference between godlike a...more...
  • Reported in: P2.0 (14-Mar-15)
#78251
PDF page: 68
Section 4.5 Cool Lexical Features Last paragraph on page 68: >>Each line of that output represents a token and contains the token index, the sta...more...
  • Reported in: P2.0 (16-Mar-15)
#78255
PDF page: 68
Would be clearer to either change "grun XML" to "grun XMLLexer", or to clarify that the suffix "Lexer" is implicit in TestRig: >>Here’s how to do a...more...
  • Reported in: P1.0 (22-Sep-14)
#77421
Paper page: 70
Chapter 5.4: the right association examples uses the old syntax: The book still shows the V4.2 style assoc while v4 has it changed running the ex...more...
  • Reported in: P1.0 (21-Sep-14)
#77405
PDF page: 74

On page 73 at the bottom of the page, the link to the java grammar
does not work. --Karl Stroetmann

  • Reported in: P2.0 (16-Aug-15)
#78770
Paper page: 77
In the subsection "Matching Numbers" there is a parenthetical note "(See Section 6.5, Parsing R, on page 104 for lexical rules that match full floatin...more...
  • Reported in: P2.0 (26-Nov-14)
#77849
PDF page: 79
This rule (near the top of the page(: assign : ID (WS|COMMENT)? '=' (WS|COMMENT)? expr (WS|COMMENT)? ; should be: assign : ID (WS|COMMENT)* '...more...
  • Reported in: P2.0 (29-Dec-14)
#77989
PDF page: 86

[final sentence of the page, the word "of" is missing, I suspect:] "... on the right side OF rule 'file'."--Ravi Ponamgi

  • Reported in: P2.0 (19-Nov-14)
#77815
PDF page: 87
In the example "examples/CSV.g4", the syntax highlight seems to be incorrect, i.e. the second line is highlighted as if it was a string, but in fact i...more...
  • Reported in: P2.0 (20-Mar-15)
#78268
PDF page: 89
Reference to bad URL on antlr.org in footnote #3: 3. h-t-t-p://www.antlr.org/grammar/java Note: I couldn't enter the full URL due to spam p...more...
  • Reported in: P2.0 (21-Sep-14)
#77408
PDF page: 102
On page 102 the rule for `expr` is stated as follows: ~~~ expr: ID '(' exprList? ')' // func call like f(), f(x), f(1,2) | ID '[' expr...more...
  • Reported in: P2.0 (28-May-15)
#78451
Paper page: 113
There is a code snippet on this page for the section 7.2-Implementing Applications with Parse-Tree Listeners. The method named "PropertyFileBaseVisit...more...
  • Reported in: P2.0 (25-Oct-15)
#79050
PDF page: 123
In this example code you're using the Java Stack class. As per the Java documentation, this is deprecated and the ArrayDeque class should be used inst...more...
  • Reported in: P2.0 (08-Jun-15)
#78477
PDF page: 145
In DefPhase.java, the statement: int typeTokenType = ctx.type().start.getType(); There is no explanation of what the "start" field is. I found an ...more...
  • Reported in: P2.0 (03-Oct-14)
#77534
PDF page: 152
When I run antlr4 on Simple.g4 I get the error message: error(65): Simple.g4:18:52: unknown attribute text for rule stat in $stat.text error(65): ...more...
  • Reported in: P2.0 (03-Oct-14)
#77535
PDF page: 157
The examples errors/TestE_Dialog.java and errors/TestE_Listener2.java do not compile because of the import directive import com.sun.istack.internal...more...
  • Reported in: P2.0 (03-Apr-16)
#80172
PDF page: 158
In source code example for "underlineError", if the string to be parsed is short enough and just one line long, and an error occurs in that one line, ...more...
  • Reported in: P2.0 (03-Mar-16)
#80034
Paper page: 162

In the diagram, under "Good Syntax", the expression is [i^2]. I believe it should be [1^2].--Breck

  • Reported in: P2.0 (06-Feb-15)
#78154
PDF page: 175
The sample errors/TestBail.java contains extends SimpleLexer I cannot find the class SimpleLexer in ANTLR4 java download. There is a class Lexer an...more...
  • Reported in: P1.0 (02-Feb-15)
#78141
Paper page: 237
In method consume() the assignment charPositionInLine = 0 should be charPositionInLine = -1. This will correct the erroneous output of TestSimpleMyTok...more...
  • Reported in: P2.0 (17-Oct-15)
#79018
PDF page: 281
Lexer Rule Elements section: The ESC rule is documented as '\\' . ; This implies that backslash quoting is needed in character literals, but on p2...more...