[antlr-interest] (Newbie) tree walker emits "GrammarSanity.traceStatesLookingForLeftRecursion "

Cameron Palmer cameron.palmer at gmail.com
Thu Aug 9 08:55:34 PDT 2007


You have two Lexer rules (DIR and ENDDIR) in your walker. If you
delete them the error goes away.

cameron.

On 8/9/07, ali azimi <aliaazimi at yahoo.com> wrote:
>
> Hi,
>
> Thank you so much for your advice. What do you think the NullPointer error
> message would be for? I checked my grammar again and again, however without
> any success. I produced another tree walker very similar to this one and
> also as large. It works perfectly. I recall that I had some NullPointer
> error messages for previous one. I sorted it out by putting some imaginary
> nodes as roots for some rules when needed. I am a newbie and started to
> learn whole of this subject nearly a month ago. I think an expert eye would
> pick the problem very quickly. Could you give me another advice so that I
> will not sit in front of my laptop and stare at the codes emotionlessly?
>
> Thank you all a million time. Without you I would not have been able to come
> even this far.
> Best regards,
>
> Al
>
> Cameron Palmer <cameron.palmer at gmail.com> wrote:
>
> It sounds like your Main program isn't correctly handing off the
> output of the Lexer-Parser to the Walker. I would verify that is
> correct. I think the error message you are seeing is just a
> consequence of the Null Pointer Exception.
>
> Cameron Palmer
> University of North Texas
>
> On 8/9/07, ali azimi wrote:
> > Hi,
> >
> > Thank you in advance for any advice.
> >
> > When I run my tree walker I receive some error messages which can be seen
> at
> > the bottom of this page. The grammar is too long and can not be posted. I
> > have tried to make sure that the grammar does not have any left recursion
> > problem. The error messages do not give me adequate information as to
> where
> > these errors are likely to be originated from. What would you suggest me
> to
> > do?
> >
> > I appreciate any help a lot.
> >
> > Best regards,
> >
> > Al
> >
> > Errors:
> >
> > Check Grammar failed:
> >
> > (10): internal error: C:\Documents and
> > Settings\ali\Desktop\antlr\FpCif12Walker.g:
> > java.lang.NullPointerException
> >
> >
> Org.antlr.tool.GrammarSanity.traceStatesLookingForLeftRecursion
> > (Unknown Source)
> >
> Org.antlr.tool.GrammarSanity.checkAllRulesForLeftRecursion
> > (Unknown Source)
> >
> > Org.antlr.tool.Grammar. checkAllRulesForLeftRecursion (Unknown Source)
> >
> > Org.antlr.codegen.CodeGenerator.genRecognizer (Unknown
> > Source)
> >
> > Org.antlr.Tool.processGrammar (Unknown Source)
> >
> > Org.antlr.Tool. process (Unknown Source)
> >
> > Org.antlr.works.generate.CodeGenerate.generate
> > (CodeGenerate.java:125)
> >
> > Org.antlr.works.generate.CodeGenerate.run
> > (CodeGenerate.java:251)
> >
> > Java.lang.Thread.run (Unknown Source)
> >
> >
> > ________________________________
> > Be a better Globetrotter. Get better travel answers from someone who
> knows.
> > Yahoo! Answers - Check it out.
> >
> >
>
>
>
>  ________________________________
> Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge to see what's on,
> when.
>
>


More information about the antlr-interest mailing list