[antlr-interest] Finding errors

Jim Idle jimi at temporal-wave.com
Mon Oct 18 08:59:42 PDT 2010


The issue will be in your grammar. However, the easiest thing is to single
step the C code as the macros are self-contained steps that you can assume
are correct (see the comments about it in the generated source). You can
also debug using ANLTRWorks, but the 3.2.1 code does not seem to be working
with remote debug of the C I am afraid. 

Look through the wiki is really the best place, as well as reading the
source. However, you don't say what version of ANTLR you are using, so it is
difficult to help. I am assuming the ANTLR 3.2.1 C target, but perhaps you
mean the 2.7.x target, which no one really develops any more. It is stable,
but what you get is what you get really.

If it 3.2.x, does your start rule include EOF as the last token?

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Steven Kibler
> Sent: Monday, October 18, 2010 12:26 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Finding errors
> 
> I have a very simple grammar compiled in C++ and an input file to
> match.
> The parser starts up, goes into the body and immediately returns
> without producing any errors that I can see.  The generated C code has
> a lot of macros in it which make debugging extremely difficult to find
> out what the problem is.
> 
> 
> 
> Questions:
> 
>   How does one examine the tokens returned from the lexer?
> 
>   How can one trace what is happening in the parser?
> 
>   How does debug work?  I occasionally see debug code in the generated
> sources but haven't determined how to do it consistently or what to do
> with it when it gets generated.
> 
>   What tools are available for tracking down some of the lexer/grammar
> issues?
> 
> 
> 
> I am most interested in where to find the answers than the answers
> themselves.
> 
> 
> 
> Steven Kibler
> 
> 
> 
> 
> 
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address



More information about the antlr-interest mailing list