[antlr-interest] C runtime issue
Gavin Lambert
antlr at mirality.co.nz
Mon Feb 2 23:22:33 PST 2009
At 10:37 3/02/2009, Andy Grove wrote:
>When I invoke my generated C parser, I see memory usage climb
>from 770MB to 4GB in a few seconds and the parser never returns.
>My init code is as follows:
[...]
>I added some printf() statements to the generated code and
>tracked the issue down to the "LA(1)" macro which expands to
>"ctx->pParser->tstream->istream->_LA(ctx->pParser->tstream->istream,
>1)". It seems that this call never completes. Here is the code in
>question:
If this is happening the first time this is called (which it
sounds like is the case), then the problem is with your lexer
grammar/rules.
Most likely, you have created an infinite loop in the lexer. The
most likely reason for this in turn is that you have created a
top-level lexer rule that can successfully match zero
characters. And the most likely cause of that in turn is that
you've used * when you really mean +.
More information about the antlr-interest
mailing list