-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Parsing invalid input #2
Comments
We don't support that at the moment Do you know if there is literature explaining how to extend the Earley Parser to that use case? |
Unfortunately I'm not very familiar with the Earley algorithm (or really parsing in general beyond recursive descent). I had a quick look, but I can't immediately find any explanation on how rowan accomplishes this beyond "a special effort of continuing the parsing if an error is detected" here. In that document, rowan refers to the desired properties as "lossless" and "resilient":
But I couldn't immediately find any literature explaining the technique. I'll keep looking :) |
Small update: I misunderstood how rowan plays in here. It is not responsible for producing the lossless syntax trees, but representing them. Therefore, the techniques we're looking for (not for Earley, but just to get a general idea of what's going on) are actually found in the users of rowan like rnix-parser and rust-analyzer. |
I was reminded of this in the rnix matrix channel today. I'd like to just dump some links I found in case anyone wants to continue investigating:
Feel free to close if this isn't something you're interested in pursuing. It seems like it would be a lot of work. |
Actually, is not much work now that we use GNU Bison as a parser generator (since nixel 5.0), it would be just a matter of using: https://www.gnu.org/software/bison/manual/bison.html#Error-Recovery I'm happy to receive contributions for it, I think the sensible places to recover from errors would be between containers, like |
Closing in favor of #3 |
One attractive feature of rnix-parser is, through its use of rowan, it is able to recover from errors and provide partial parses for input. This is especially useful in the context of editor tooling where the code is frequently invalid while it is being edited. How does nixel/santiago stack up in this respect?
The text was updated successfully, but these errors were encountered: