[Haskell-cafe] Error detection in GLR Happy grammar
p.c.callaghan at durham.ac.uk
Sat Oct 14 17:15:41 EDT 2006
"error" isn't implemented yet in GLR mode - it is ignored.
Note that yacc-style error handling can't be transplanted directly into
GLR, since the nature of parse errors is not the same. In LR(k) errors
mean that the single parse can't continue and hence some remedial action
is needed. In GLR, it could mean this (when following one unique parse),
or with multiple parses that some are being dropped because further input
has ruled them out. Recovery on the latter probably isn't correct - they
should be discarded.
I might try allowing an explicit error token which acts only when one
parse is live, and follow standard Happy behaviour for this. If you have
an example to test on, it might be useful.
Note that for failed parses, you are given a list of unconsumed tokens and
the partial parses constructed so far, so some diagnosis is possible.
ps. I've almost fixed the module header problem you mentioned before.
More information about the Haskell-Cafe