diff --git a/C_C++/bison/error.y b/C_C++/bison/error.y new file mode 100644 index 0000000..0be8122 --- /dev/null +++ b/C_C++/bison/error.y @@ -0,0 +1,27 @@ +/* @BAKE + bison -Wcounterexamples --header=error.tab.h -o error.tab.c $@; + gcc error.tab.c -o error; + ./error; + @STOP +*/ +%{ +#include +#include +#include "error.tab.h" +int yylex() { + static int i = 0; + const int alpha[] = {B, 0}; + return alpha[i++]; +} +void yyerror() { ; } +%} +%token A B +%% +i: A + | error B { yyerrok; puts("We recovered!"); } + ; +%% +signed main() { + yyparse(); + return 0; +}