[antlr-interest] getting exception while freeing parser (Is something wrong with grammar rule?)

Jim Idle jimi at temporal-wave.com
Wed Jun 10 08:25:47 PDT 2009


ajit vilasrao shinde wrote:
> Hello EveryOne,
>  I have a problem while using generated parserlexer from following 
> grammar.
> while using parser it is giving exception while freeing parser.
> parser->free(parser);
Can't see anything directly wrong with your grammar, except that you 
should probably not be using global backtracking, even with memoizing. 
Methods like free usually are pointing out that you have corrupted 
memory somewhere in your own code, which malloc picks up when it tries 
to free up the parser allocations.

If you download and install valgrind, assuming you have a Linux machine 
available and given the proliferation of run from CD, run from USB, free 
VM definitions, then you should ;-), then compile all your code in debug 
mode and run it under valgrind. Valgrind will usually point out your 
mistake instantly. It is possible there is something wrong in the 
runtime, but the C runtime users tend to find this pretty quickly, if 
there is.

Jim


More information about the antlr-interest mailing list