goodmami / goodmami/pe

(Helpful) Error messages

Open
#39 3 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
51
Forks
4
PR merge metrics
No merged PRs in 30d

Description

It would be very handy if parsers generated by `pe` were able to produce proper error messages when they fail to parse a given input. This includes pointing out the longest possible sequence of the input that the parser was able to match and then telling the user what the parser would have expected in order to continue matching from there.

E.g. when using a grammar such as
```
match < "Hello" "world"
```
matching an input of `Hello` should say something like `At line 1, col 5: Expected "world"` or if there were multiple alternatives:
```
match < "Hello" ("world" / "universe")
```
`At line 1, col 5: Expected one of: "world", "universe"`

For character classes one can simply print their definition as the expected value and for rule references print the name of the rule.

See e.g. the error messages that ANTLR produces.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.