I am currently using the Bison feature error in my grammar rules in various places similar to the following:
nonterminal:
someother_nonterminal SEMI
| another_nonterminal SEMI
| error SEMI {printf("Some helpful message"); yerrork;}
This works predictably for the most part. I just want to rely on the semicolon as the reset point for error reporting. I understand no single general approach will work for all parsing errors (i.e. misleading cascading errors as a result of an initial error). I am looking for a more general and simple solution. Is there a Bison declaration, perhaps something like %error_reset_terminal, that simply tells Bison to absorb any error up to the nearest semicolon (SEMI terminal label).
If such a feature exists, then I can avoid the shift-reduce headaches associated with error absorption in grammar rules.
I do not really need specific error handling messages. My language implements features/keywords like using, namespace, and general struct like objects with braces. As such, putting an error absorption rule in the starting nonterminal is not very helpful. I am hoping Bison has a general declaration that I can use.