[antlr-interest] Parsing a little at a time?

Rick Mann rmann at latencyzero.com
Sun Oct 14 14:01:14 PDT 2007


On Oct 14, 2007, at 12:51 PM, Stanimir Stamenkov wrote:

> Sun, 14 Oct 2007 11:15:44 -0700, /Rick Mann/:
>
>> I'd like to parse input as I get it from the user, a line at a time.
>
> Try searching this list archives [1] for "incremental" or  
> "incremental parsing":
>
> http://www.google.com/search?q=incremental+site%3Aantlr.org
> http://www.google.com/search?q=incremental+parsing+site%3Aantlr.org
>
> [1] http://www.antlr.org/pipermail/antlr-interest/


Thanks for the terminology. It seems, from ten minutes of reading the  
archives, that incremental parsing is not possible, or at least very  
difficult in LL(*) grammars.

I also read notes from Terrence saying he'd try to address this in  
ANTLR 3. Terrence?

I'm not sure I understand why the choice of grammar would influence  
this so much. I guess if the parser is recursive (is it? I don't  
know), then it would be really hard to save state and exit.

In my case, I'm never going to send end input on a partial token. I  
would like to send partial constructs, though, like this:

struct Foo {	// one line
   int field1;   //another line
   int field2;   //another line
};              //last line

Hmm. This makes me sad.

Thanks.

-- 
Rick



More information about the antlr-interest mailing list