examples: bistromathic: demonstrate error recovery

* examples/c/bistromathic/parse.y: here.
* examples/c/bistromathic/bistromathic.test: Check it.
Included a stupid case where the error is actually ignored.
This commit is contained in:
Akim Demaille
2020-04-25 15:03:01 +02:00
parent c90110efd3
commit 60366b152b
4 changed files with 21 additions and 3 deletions

View File

@@ -146,6 +146,7 @@ exp:
| "-" exp %prec NEG { $$ = -$2; }
| exp[l] "^" exp[r] { $$ = pow ($l, $r); }
| "(" exp ")" { $$ = $2; }
| "(" error ")" { $$ = 666; }
;
// End of grammar.