[antlr-interest] Language Design Patterns Section 12.5 Problem

Jan Nielsen jan.sture.nielsen at gmail.com
Mon Aug 31 22:24:47 PDT 2009


I'm not sure if this is the right forum to discuss a little problem I
encountered in section 12.5 of Language Design Patterns (B6.0), but
I'm sure this is the most likely spot for some help...I got the
following:

  java -cp antlr-3.1.3.jar org.antlr.Tool Cymbol.g Gen.g
  warning(200): Cymbol.g:94:45: Decision can match input such as
"'else'" using multiple alternatives: 1, 2
  As a result, alternative(s) 2 were disabled for that input
  error(100): :1:1: syntax error: antlr: Gen.g:1:1: unexpected token: operator
  error(10):  internal error: Exception java.lang.ClassCastException:
antlr.CommonToken cannot be cast to
antlr.TokenWithIndex at antlr.TokenStreamRewriteEngine.next
  Token(TokenStreamRewriteEngine.java:161): can't parse template action

  error(100): Gen.g:0:0: syntax error: codegen: <AST>:0:0: unexpected
end of subtree

Per the eBook, I'm expecting the warning(200) but the errors end up
causing the generated Gen.java to break:

  Gen.java:1851: illegal start of expression
              retval.st = ;
                          ^
  1 error

Any thoughts from those of you who have paid for the EA eBook (or
written it :-)?


Thanks,

Jan


More information about the antlr-interest mailing list