[antlr-interest] Help with null tree?
Kim Slattery
slattery.kim at gmail.com
Tue Apr 19 08:30:50 PDT 2011
Hi, all. I've been working on translating the language our lab has created
(Hop) to Java, and I keep hitting a wall. Has anyone had experience with the
StringTemplate returned by getTemplate() being null? When I debug, st
inside the tree returned by the tree grammar is null, and I can't figure out
why. Is this because there's something wrong with the template? Any
guesses?
I'm referring to code that, from Dr. Parr's books, looks like:
Gen.prog_return r2 = walker.prog(parser.numOps, parser.locals);
Above, the st in the start_return (or prog_return, or what is returned by
the start rule) of r2 is null. And:
StringTemplate output = (StringTemplate)r2.getTemplate();
System.out.println(output.toString());
Because st is null, the output is obviously null. My rules all seem to be
syntactically correct. I don't understand... Any help, in certain or guess
form, is appreciated.
Kim
More information about the antlr-interest
mailing list