[antlr-interest] How to make a restartable parser ?

Vincent De Groote list.encelade at gmail.com
Sat Mar 7 09:31:46 PST 2009


Hello,

Is there a way to use the parser generated by ANTLR as a "restartable"
parser ?

The problem I try to solve is:
The text I need to parse is a text fragment.  It will be followed by other
text fragments, until end of file.
I do not want to accumulate fragments, because the input may be very big.
I suppose I could generate a lexer with a special token 'restart'.  When
such a token is received by the parser, the parser should save its state,
and return with a specific result code.  When I receive more text, the
parser should restart with the state saved before.

Is there a way to handle this model with ANTLR ?

Thanks for your replies

Vincent De Groote
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090307/75c810db/attachment.html 


More information about the antlr-interest mailing list