[antlr-interest] Incremental Parsing?

Sohail Somani sohail at taggedtype.net
Mon Jul 16 18:44:43 PDT 2007


Well my possibly flawed assumption was that the grammar would look
something like this:

// csv parser
startRule: singleRecord*;

...

If you start your parser at startRule then it will exhaust all input
before returning, but if you start it at singleRecord, it should only
care about enough tokens to satisfy the one rule.

On Tue, 2007-07-17 at 11:30 +1000, Jonathan Thomas wrote:
> How would one go about doing that, Sohail?
> I'm also mildly interested in such a solution.
> 
> Sohail Somani said the following on 17/07/2007 11:25 AM: 
> > On Mon, 2007-07-16 at 20:51 -0400, Benji Smith wrote:
> >   
> > > The JavaCC parser works well, except that I can't parse the file
> > > record-by-record. I have to parse the entire file, returning a
> > > collection of Record objects at the end.
> > >     
> > 
> > Set up your grammar to only do one record at a time. Then keep parsing
> > until you get back a null record (or whatever)
> > 
> > Should work ;-)
> > 
> > 
> >   



More information about the antlr-interest mailing list