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

Foolish Ewe foolishewe at hotmail.com
Tue Dec 19 10:09:23 PST 2006


Thanks Dave:

I'll give this a try, it may be a day or two before I can do it as I've 
other fish to fry at the
moment.  I've given some more background in my reply to Kay Roepke.

Regards:

Bill M.


>From: David Holroyd <dave at badgers-in-foil.co.uk>
>To: antlr-interest at antlr.org
>Subject: Re: [antlr-interest] Aggressive vs. Lazy Buffering in ANTLR
>Date: Tue, 19 Dec 2006 17:19:29 +0000
>
>On Tue, Dec 19, 2006 at 03:59:47PM +0000, Foolish Ewe wrote:
> > 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?
>
>I've got this one you can use,
>
>   
>http://svn.badgers-in-foil.co.uk/metaas/trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/antlr/LinkedListTokenStream.java
>
>It happens to also create a doubly-linked list of Tokens, but you can
>just strip that out, I expect.
>
>ta,
>dave
>
>--
>http://david.holroyd.me.uk/

_________________________________________________________________
Get free, personalized online radio with MSN Radio powered by Pandora 
http://radio.msn.com/?icid=T002MSN03A07001



More information about the antlr-interest mailing list