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

Grammar debugging? #164

Open
davaya opened this issue May 28, 2020 · 0 comments
Open

Grammar debugging? #164

davaya opened this issue May 28, 2020 · 0 comments

Comments

@davaya
Copy link

davaya commented May 28, 2020

I'd like to use Parsimonious because of its goals - a lightweight parser to handle fairly simple grammars. But it isn't being actively developed, so the "Amazing grammar debugging" that was to be coming soon as of 2014, likely won't.

Situation: I have a toy grammar and test data, which gives an error like:

parsimonious.exceptions.ParseError: Rule 'start' didn't match at '
blah blah blah' (line 1, column 1).

(The specifics don't matter, I can debug this grammar. I'm looking for a process to debug real grammars.) I imagine that the parser is working through various rules, trying, failing, backtracking, trying again, but I have no visibility into the specific rule and it's text that I think should match but don't.

Lark (an Earley parser) is remarkably forgiving of errors and helpful at finding them. But I'm looking for the simplest lightest-weight parsing engine to use at runtime, and I'm guessing that PEG fits that bill. If only there were a PEG debugger.

So does anyone have a recommendation for an amazing PEG debugger? After developing a working grammar in an unconstrained environment, Parsimonious could still be used as a lightweight tool to parse the data.

===== Edit =====
Found it at http://textx.github.io/Arpeggio/stable/debugging/. But Parsimonious fails on some grammars that work in Arpeggio for reasons that are not yet clear. Grammars aren't identical but the translation seems straightforward (add an EOF token, replace regex flag~ with r).

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

No branches or pull requests

1 participant