Hello Daniel, > What has been done about parser recovery over quasi-valid input in PEG? > > That probably depends on the language you are defining.
Interesting thought. I agree. > The core idea is to have a grammar rule R which defines the content of a > section, while a rule T defines the terminator for that section. We than > have a rule template 'recoverable<R,T>' which tries to parse a sequence of > R and T. If that fails, it skips over the input until it can parse T, > calling an action for the skipped part of the input to allow error > reporting/recording, then continues after T. You can use recoverable<R,T> > multiple times in your grammar to allow as-local-as-possible recovery. We > haven't used it in practice, though. I've inserted that kind of rule manually into some parsers, not for recovery, but to skip over uninteresting parts of the input (which is kind of what recovery needs to do). Perhaps hand-crafted recovery (a recipe) using recovery rules is the way to go? -- Juancarlo *Añez*
_______________________________________________ PEG mailing list PEG@lists.csail.mit.edu https://lists.csail.mit.edu/mailman/listinfo/peg