[antlr-interest] Memory explosion
Dominique.Duflos at alcatel-lucent.fr
Dominique.Duflos at alcatel-lucent.fr
Wed Sep 26 02:08:24 PDT 2007
Martin Probst wrote:
> The SPACE token can be zero length, i.e. it probably produces _a lot_ of
> tokens for that rule.
>
> On Tue, 25 Sep 2007 16:47:11 +0200, Dominique.Duflos at alcatel-lucent.fr
> wrote:
>
>> Hi all,
>> The parser eats all available memory when parsing the three-character
>> string "N A" using this three-line grammar:
>>
>> grammar mml;
>> mml : 'R' ;
>> SPACE : (' ')* ;
>>
>> What is wrong ?
>>
>
>
Thank you! I will avoid zero-length tokens in the future.
No more memory catastrophies after correcting the original grammar to
SPACE : (' ')+ ;
and
SPACE? instead of SPACE in the parser rules.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070926/402dca3a/attachment.html
More information about the antlr-interest
mailing list