LPegLabel provides a recovery mechanism based on labels plus a recovery
operator:
https://github.com/sqmedeiros/lpeglabel

The use of labels was discussed in a paper about error reporting . Isso
amanhã writing a new paper about the recovery mechanism. I hope the first
 version oferece the paper will be ready in a few weeks.

Em 21/05/2017 06:51, "Juancarlo Añez" <apal...@gmail.com> escreveu:

> 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
>
>
_______________________________________________
PEG mailing list
PEG@lists.csail.mit.edu
https://lists.csail.mit.edu/mailman/listinfo/peg

Reply via email to