modification of yacc so yyparse becomes NON-reentrant

ethan@niwot.scd.ucar.EDU (Ethan Alpert)
Tue, 18 Oct 1994 19:28:48 GMT

          From comp.compilers

Related articles
modification of yacc so yyparse becomes NON-reentrant ethan@niwot.scd.ucar.EDU (1994-10-18)
| List of all articles for this month |
Newsgroups: comp.compilers
From: ethan@niwot.scd.ucar.EDU (Ethan Alpert)
Keywords: yacc, parse, question
Organization: Compilers Central
Date: Tue, 18 Oct 1994 19:28:48 GMT

Has anyone modified byacc (or any other parser generator) to save its
state when it returns? I have an application that I do not want to block
in yylex when there is no input waiting. Input arrives asynchronously and
the application must do lots of ancillary functions between inputs (i.e.
refresh X window display and handle X events). What I'd like to do is have
yyparse not reset itself to state 0 on invocation, but start in the same
state it was when it returned. I've designed the grammar and parser to be
able to return when the input string has been completely parsed, but am
not completely sure what I can do to save yyparse in the same state.


I've looked at byacc's template file and it seems like it would not be a
problem to make all of the local variables static globals and add code to
execute the initialization portion only once rather than each invocation.
In fact this appears to work but I'm not sure I haven't screwed something
up.


Any comments would be most welcome.


Thanks,
-ethan
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.