help-bison
[Top][All Lists]
Advanced

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

how to do nested calls to yyparse ?


From: Guillermo Rodriguez Garcia
Subject: how to do nested calls to yyparse ?
Date: Thu, 07 Nov 2002 22:53:05 +0100

Hello all,

I'm in a case where I need to call yyparse() from some code that
has been called by yyparse().

In case it helps: I have a shell for which I have defined a grammar
and used flex + bison to implement the parser. Then in the startup
code, after initialising some stuff, I call yyparse(). Normally
that will parse all commands until EOF, then return, and at that
point the shell will exit.

So far so good -- I guess you've heard that a million times :)

The problem is that one of the shell commands ('source') needs to
parse a script file in the context of the shell, and it needs to
parse this script _immediately_ before doing anything else. So the
code for this command would need to switch to a different buffer
(this is the flex part) and then call yyparse() to parse that buffer,
then switch back to the original buffer, and continue the process
normally.

From the code it looks that nested yyparse() calls would not work
because of global variables, etc.

Anyone knows how can I do this?

Thanks,
G.





reply via email to

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