[antlr-interest] Out of Memory

Gavin Lambert antlr at mirality.co.nz
Tue Oct 6 01:48:08 PDT 2009


At 12:37 6/10/2009, Kirby Bohling wrote:
 >Couldn't you do that in the lexer/parser?  Just don't match EOF 
on
 >the start rule?  That you can just have something like:
 >
 >parser.game_prefix();
 >while (game_or_end_return = parser.game_or_end()) {
 >// Process game here
 >// make sure it you didn't hit the end case here.
 >}
 >
 >That might not make the lexer dump everything, but I thought 
that
 >would get the parser to not have everything in there.

Unfortunately not; the default behaviour of the lexer/token-stream 
is to translate the entire input into tokens before processing 
parser rules.  So you'd at least need to use a modified one that 
tokenises only as much as required each time; I think there's an 
example of this on the Wiki.



More information about the antlr-interest mailing list