Iam using c lexer that is flex generated and a c++ parser that is bison generated. i have modified the parser to acccept only string input.
I am calling the parser function yyparse in a loop and reading line by line of user input. I stop the loop if the input is "quit".
The problem i am facing is that when input does'nt match any rule then, the parser stops abruptly, and at next iteration starts off
at same state, expecting the rule which was stopped (due to synatx error )to complete.
It works fine if the input is valid and matches a parser rule.
On syntax error i have redefined the yyerror function, that displays a simple error message.
How do i clear the state of the parser when the input does'nt match any parser rule, and at next iteration the parser starts afresh.
I am calling the parser function yyparse in a loop and reading line by line of user input. I stop the loop if the input is "quit".
The problem i am facing is that when input does'nt match any rule then, the parser stops abruptly, and at next iteration starts off
at same state, expecting the rule which was stopped (due to synatx error )to complete.
It works fine if the input is valid and matches a parser rule.
On syntax error i have redefined the yyerror function, that displays a simple error message.
How do i clear the state of the parser when the input does'nt match any parser rule, and at next iteration the parser starts afresh.