[antlr-interest] Out of memory error

Jim Idle jimi at temporal-wave.com
Wed Mar 14 16:50:47 PDT 2007

You could probably reduce the memory requirements by expressing this
slitghtly differently (needs experimentation), though you can increase
the heap space on the jvm when you run ANTLR of course. I wonder if this
will help you:

	: '{' (tcs=tableConstants)? (bs+=blockStatement)* '}' 


Then if you really do wish to write only the tableConstants and ignore
the blockStatements you can set a flag or check for null in a
conditional rewrite:

	: '{' (tcs=tableConstants)? (bs+=blockStatement)* '}' 

	-> {$tcs==null} ^(BLOCK_STATEMENT $bs*}
	-> 	          ^(SLIST $tcs)

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Mark Bednarczyk
Sent: Wednesday, March 14, 2007 3:33 PM

Here is the rule that triggers this error. If I comment out the second
alternative, I don't run out of memory:

	:	('{' tableConstant)
		=> ('{' tableConstants blockStatement* '}')
		-> ^(SLIST tableConstants+)
	|	'{' blockStatement* '}'


More information about the antlr-interest mailing list