[antlr-interest] Antlr Book Chapter 3 troubles

Jim Idle jimi at temporal-wave.com
Fri Sep 5 13:26:53 PDT 2008


On Fri, 2008-09-05 at 13:17 -0700, Terence Parr wrote:

> On Sep 5, 2008, at 12:44 PM, Tim Halloran wrote:
> > [15:36:28] error(10):  internal error: /Users/tim/Source/antlr-Work/ 
> > Ch3 Expr AST/src/Eval.g : java.lang.NullPointerException
> > org.antlr.codegen.CodeGenTreeWalker.atom(CodeGenTreeWalker.java:1959)
> 
> I don't see rule atom.


That's the ANTLR stack trace not the grammar trace. This is happening
because something in the input source for the tree grammar is wrong, but
the v3 grammar doesn't catch it and produces a tree that causes NPE.

At the moment, the only way to work out what it is, is to remove your
actions one at a time and try, then remove any parameters or returns and
so on, and suddenly it will compile - then you will know which bit is in
error.

However I can save you a little trouble by pointing out that the problem
is this:

| ^('=' ID.expr)

You have put ID.expr in the grammar spec and it needs to be just ID.

Jim

> 
> Ter
> >
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080905/b14044cd/attachment.html 


More information about the antlr-interest mailing list