[antlr-interest] OutOfMemory: impossible to process java comments only?

SainTiss saintiss at arklinux.org
Wed Apr 14 05:22:38 PDT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi again,

It seems the problem can be circumvented by appending "\n;" to any input I 
give to the parser. This makes sense, since in that case there always is at 
least one statement, being the empty statement...

So at least it seems the problem is effectively related to the parser not 
seeing any tokens (because whitespace and comments are probably just 
discarded by the lexer?). Is it possible that this leads to the apparent 
infinite loops I'm experiencing?

Thanks,

Hans

On Tuesday 13 April 2004 15:14, SainTiss wrote:
> Hi,
>
> I've got a serious problem here. I've got this rule in the Java grammar,
> which allows parsing of a number of java statements:
>
> statementSequenceOnly
>
> 	(
> 		statement
> 	)*
> 	EOF!
> ;
>
> This works fine, in general... However, when I feed the parser some input
> which just consists of a comment (so there are zero statements), I get an
> OutOfMemory error. I pinpointed the problem to the following statement in
> the generated code:
> if ((_tokenSet_0.member(LA(1)))) {
>
> More specifically, it seems there is an endless loop on LA(1).
>
> I tried creating a rule with just EOF!, but I got the same problem. This
> time, there seemed to be an endless loop on
> match(Token.EOF_TYPE);
>
> Am I doing something wrong here?
>
> Thanks,
>
> Hans

- -- 
Ark Linux - Linux for the Masses (http://arklinux.org)

Capitalism: 
You don't have any cows. The bank will not lend you money to buy cows, 
because you don't have any cows to put up as collateral.

Representative Democracy:
You have two cows. Your neighbors pick someone to tell you who gets the milk. 

In a world without walls and fences, who needs windows and gates?

Hans Schippers
2LIC INF
UA 2003-2004
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFAfS0RXlnUYIbmLOQRAoYwAKCC3XBMc/9gkeYFPiFA/rwMpnlh0QCeNn+W
NlgLEV2cJFg6uAfpOehqomU=
=Hs1n
-----END PGP SIGNATURE-----



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list