[antlr-interest] Possible incremental parse approach?
Randall R Schulz
rschulz at sonic.net
Sun Oct 14 14:45:14 PDT 2007
On Sunday 14 October 2007 14:28, Rick Mann wrote:
> Maybe I could do this? Run my parser in a separate thread. The input
> character stream can block when it needs more data, at which point
> the main thread of my GUI app could put data into its queue...
There's a problem with this. Ordinarily, ANTLR treats lexical analysis
as a distinct phase of processing which must complete before parsing
begins. If the lexical analyzer doesn't get and end-of-file, it will
effectively just wait until it does.
If your parser does not generate an AST, then that's fine. The action
code does everything (triggering whatever follow-on processing is
required). But if you're building an AST for parsgin by a tree parser,
then you have to figure out what to do about the fact that the tree is
never complete _and_ the fact that it grows without bound throughout
the execution of the system.
> Does this approach sound like it would work?
It sounds problematic to me.
Randall Schulz
More information about the antlr-interest
mailing list