-
Notifications
You must be signed in to change notification settings - Fork 447
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
feat: custom error recovery in parser #3413
feat: custom error recovery in parser #3413
Conversation
Mathlib CI status (docs):
|
!bench |
Here are the benchmark results for commit 253dda4. |
253dda4
to
00154c7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parser framework changes look great. For the grammar changes it would be nice to have a less manual approach as discussed but this is a good start.
Adds the missing RELEASES.md from #3413. Apologies for the oversight!
Adds a simple error-recovery mechanism to Lean's parser, similar to those used in other combinator parsing libraries.
Lean itself isn't very amenable to error recovery with this mechanism, as it requires global knowledge of the grammar in question to write recovery rules that don't break backtracking or
<|>
. I only found a few opportunities.But for DSLs, this is really important. In particular, Verso parse errors interacted very badly with Lean parse errors in a way that required frequent "restart file" commands, but this mechanism allows me to both recover from Verso parse errors and to have Lean skip the rest of the file rather than repeatedly trying to parse it as Lean commands.