I recover from errors simply by parsing them like anything else, for
instance, I might have a data type like
data Exp
= Lam Var Exp
| Ap Exp Exp
| Const Var
| Error SourceLocation Description
then have a rule like
expression = lambda // application // const // parse_error
Then after parsing when I process the results, I can display the errors.
This also has the huge advantage of allowing creation of a lazy parser,
one that can start returning results before it has consumed all its
input, making the space usage potentially (and very likely in practice)
sub-linear with packrat parsing speed.
John
--
John Meacham - ⑆repetae.net⑆john⑈
_______________________________________________
PEG mailing list
[email protected]
https://lists.csail.mit.edu/mailman/listinfo/peg