Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Throw and Label operations #387

Open
DavidSouther opened this issue Jul 17, 2022 · 0 comments
Open

Implement Throw and Label operations #387

DavidSouther opened this issue Jul 17, 2022 · 0 comments

Comments

@DavidSouther
Copy link

https://arxiv.org/pdf/1806.11150.pdf with proof of concept in https://github.com/sqmedeiros/lpeglabel

We propose a conservative extension, based on PEGs with labeled failures, that adds a syntax error recovery mechanism for
PEGs. �is extension associates recovery expressions to labels, where a label now not only reports a syntax error but also uses this recovery expression to reach a synchronization point in the input
and resume parsing.

The syntax using ^ as the synchronization operator feels fairly clean? I'm not sure whether throw should be %{l} or, better, Throw to make it obvious. One would require special casing syntax; the other, special casing a function. ListOf sort of does that? but IIRC the semantics phase, not in the grammar.

Some overlap with #302 here, and I don't know if this would affect #158 if one were to try to resynchronize to the proposed @rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants