Related articles |
---|
Input-driven lexical scanner olaf@bigred.inka.de (2000-12-18) |
Re: Input-driven lexical scanner cfc@world.std.com (Chris F Clark) (2000-12-19) |
Re: Input-driven lexical scanner vbdis@aol.com (2000-12-20) |
Re: Input-driven lexical scanner rog@vitanuova.com (2000-12-20) |
From: | rog@vitanuova.com (Roger Peppe) |
Newsgroups: | comp.compilers |
Date: | 20 Dec 2000 17:24:16 -0500 |
Organization: | Compilers Central |
References: | 00-12-078 00-12-090 |
Keywords: | lex, parallel |
Posted-Date: | 20 Dec 2000 17:24:16 EST |
Olaf wrote:
> 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
example.
This should enable you to use any parser out there in an input-driven
manner, including the original yacc.
cheers,
rog.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.