[antlr-interest] Aggressive vs. Lazy Buffering in ANTLR

Foolish Ewe foolishewe at hotmail.com
Tue Dec 19 07:59:47 PST 2006


Hi All:

Thanks for the help (especiallly Ter), in a previous e-mail, I suggested 
that aggressive buffering in
in ANTLRInputStream made ANTLR problematic for parsing interactive input, 
since the
ANTRLInputStream constructor blocks on reading all input until EOF into a 
buffer.

However, I tried making a simple input method that uses Lazy buffering (i.e. 
reads characters
on demand extending the buffer).  This lazy input stream no longer blocks on 
the constructor,
however, now I've noticed that the CommonTokenStream constructor appears to 
block.
It appears to be blocking in fillBuffer, but I don't see an explicit call in 
the constructor.
The impact of this is that it negates the interactive support that the lazy 
buffering of my
home-grown input stream class, so I'd like to fix it.

Is there a lazy buffering (buffer as input becomes available/on demand) 
variant of TokenStream
support or have I made some error?

This interactive sort of support might allow ANTLR to be used for a wider 
class of application,
e.g. for parsing piped input (log messages delivered through pipes),
nteractive scripting languages, etc. and may widen the appeal of ANTLR.

Regards:

Bill M.

_________________________________________________________________
Visit MSN Holiday Challenge for your chance to win up to $50,000 in Holiday 
cash from MSN today! 
http://www.msnholidaychallenge.com/index.aspx?ocid=tagline&locale=en-us



More information about the antlr-interest mailing list