help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question on parsing streaming input in Bison/Bison++


From: Hans Aberg
Subject: Re: Question on parsing streaming input in Bison/Bison++
Date: Fri, 1 Dec 2000 10:51:47 +0100

At 12:05 -0800 0-11-30, Sriram Sankar wrote:
>Thanks for the response. I'm using TCP sockets and that makes sure
>the packets come in sequentially. Also I'm trying to avoid the
>multithreaded idea since the context switching in Linux is very slow.
>I have a callback system where the requests are broken into subtasks
>and get queued and and once the subtasks get handled, a callback function
>is called to handle the next step.

But if they come in sequentially, what is the point of breaking down the
parsing into smaller blocks? -- Under C++, the Flex output program reads
the sequential input stream, translates it into lexemes or "tokens" which
the Bison outout program parsers. Flex will read the characters as the
stream makes them available; in effect, you will have a getc() function
waiting for the next character to arrive. So you could derive a class from
std::istream that produces a character whenever it arrives; then Flex will
automatically read it. One can make Flex "interactive", minimizing
lookahead, but that is in fact slower.

So what do you want to achieve?

  Hans Aberg
                  * Email: Hans Aberg <mailto:address@hidden>
                  * Home Page: <http://www.matematik.su.se/~haberg/>
                  * AMS member listing: <http://www.ams.org/cml/>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]