'Partial parsing and recovery of Menhir
There is a very small calculator in Sedlex and Menhir. Now, I would like to make the calculator to be able to parse expressions like 1+. So I modified parser.mly to
... ...
main:
expr EOL { $1 }
;
expr [@recovery (E_int 0)]:
INT { E_int $1 }
| BOOL { E_bool $1 }
... ...
But evaluating 1+ still returned an error Fatal error: exception Parser.MenhirBasics.Error.
Could anyone help?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
