Hi- I have written a menu-driven C program, where one of the menu options is to read and execute a script file. The script contains statements written in a language I have defined using lex and yacc (actually it's bison).
So when the menu option is selected, I open the specified script file, set lex's yyin file pointer to point to the file, then call yyparse(). If no errors are detected during the pasrsing of the script file, I can select the same menu option again and it all works fine. However, if an error is detected, the parser appears to be left in a state such that selecting the menu option again (eg. after correcting the error in the script file) results in spurious errors eg. on the first line of the file. However, if I stop the menu program and run it again, and select the script option with the same script file as input, I don't get the errors. If there some functional way of forcing lex/yacc back to their initial state? Or am I doing something wrong? Cheers John
