
Including a Flex/Yacc parser to my C program
I'have made my own parser, which works good alone
But, when i want to include it in my program, a encounter a problem :
i can't parse 2 times in the same instance of the program
For example, if a have
For (i = ; 1 < 10 ; i++) {
_yy_switch_to_string(<string i want to parse>);
// the function _yy_switch_to_string is what i use to set a string
for
input of the parser
yyparse();
Quote:
}
And, at the second execution of the for loop (when i = 2)
i get a seg fault in the yyparse call .. whereas the parsing works well the
first time
So, i suppose i have to make a reset of the parser .. but how ..
the flex-generated function yy_restart(FILE *) doesn't change anything ...
note : i've made other tests and i notice that i get the same problem with
a simple parser .. and that i again get this problem if a change the method
for inputing the string to the parser (for example with overloading yyin
with a FILE* containing my string)
Anybody can help ?
Thanks in advance ..
Antoine Thierry