Hi,
I'm trying to use GNU bison to parse from a "continuous" stream, that
is, I do want to implement a program similar to a shell: parse one
"command" at a time, process it, and continue until end-of-stream is
encountered.
However, I do want my parser to return the parsed tree to the calling
program to process it on each step, so ideally I'd like bison to return
from yyparse() when a complete instance of the start symbol is read, but
it seems it does not do this (waits for special 0-token, as far as I
found out)--to counter-act, I currently do something like this:
start_symbol:
real_start_symbol
{
storeValueForProcession($1);
YYACCEPT;
}
;
This works, except that the YYACCEPT seems to discard the current
look-ahead-token if some has been read, meaning it is missing from the
input when parsing the next step.
I'm aware that I could do the processing right inside the bison action
instread of returning the token value, but this is something I'd like to
avoid because it does not fit in well with my current design. Is there
some way I can make bison return whenever the start-symbol is
successfully reduced and keep its stack and the like so I can continue
parsing the next instance of it with the next call to yyparse()?
Thank you very much,
Daniel
--
Got two Dear-Daniel-Instant Messages
by MSN, associate ICQ with stress--so
please use good, old E-MAIL!
_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison