Answers for "how to continue parsing after error yacc"

C
1

how to continue parsing after error yacc

In error recovering there some principals you should know:

we should add the error token as an alternative to the reduction (done)
we should tell our parser that the error is ok and we call for that yyerrok (not done)
you can also use the yyclearin to discard current token

PS; the chronology of execution:

in error case, yyerror is called the yyerrstate equals 1 after that yyerrok is called it reinitialize the error status at 0 and you can obviously call any macro after that...

Code : 

```
  |error { yyerrok; yyclearin;printf("set error abourt!");}
  ;
```
Posted by: Guest on February-27-2021

Code answers related to "how to continue parsing after error yacc"

Code answers related to "C"

Browse Popular Code Answers by Language