|Input-driven lexical scanner firstname.lastname@example.org (2000-12-18)|
|Re: Input-driven lexical scanner email@example.com (Chris F Clark) (2000-12-19)|
|Re: Input-driven lexical scanner firstname.lastname@example.org (2000-12-20)|
|Re: Input-driven lexical scanner email@example.com (2000-12-20)|
|From:||firstname.lastname@example.org (Roger Peppe)|
|Date:||20 Dec 2000 17:24:16 -0500|
|Posted-Date:||20 Dec 2000 17:24:16 EST|
> An application I'm writing needs the opposite way: the scanner routine
> gets called with an input buffer as argument (variable size - may even
> contain only a single byte). It has to process this, and on completion
> of a token, call a processing routine with that token as argument. It
> is not possible to block or wait for input in any way.
Another possibility that I haven't seen mentioned here is that of
using threads. In a threaded environment, it should be possible to
run the parser in a seperate thread, calling the lexer, which blocks
when it needs more tokens.
The main thread acts as usual, getting input (not blocking) and
sending that input to the parsing thread.
This is almost trivial if the thread library provides a channel
communication primitive, as the Plan 9 threads library does, for
This should enable you to use any parser out there in an input-driven
manner, including the original yacc.
Return to the
Search the comp.compilers archives again.