-
Notifications
You must be signed in to change notification settings - Fork 164
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
Haskell: errors as record types #423
Comments
Hello Anton @vkpgwt, thanks for your suggestion and your interest in BNFC! I suppose this is for the Haskell backend only? (The other backends also do not have structured error reporting.) You might be aware that there is a common testsuite for all backends, to ensure that the generated parsers and printers behave uniformly. (However, this does not stop individual backends to have special features.) To keep code duplication minimal, I suggest to refactor the Haskell backend to always produce a structured error in the parser, an only convert to string errors in the top-level parser functions (unless I suggest |
I'm confused. Having And if the token name type is driven by the existing option, this option would look like |
It simplifies implementing options that require a checked argument like '--mode=mode1|mode2|mode3'. Such option will be added in the following commit.
A new option "--errors" is introduced, which can change the parser failure type from 'String' to a record type.
It simplifies implementing options that require a checked argument like '--mode=mode1|mode2|mode3'. Such option will be added in the following commit.
A new option "--errors" is introduced, which can change the parser failure type from 'String' to a record type.
A new option "--errors" is introduced, which can change the parser failure type from 'String' to a record type.
It simplifies implementing options that require a checked argument like '--mode=mode1|mode2|mode3'. Such option will be added in the following commit.
A new option "--errors" is introduced, which can change the parser failure type from 'String' to a record type.
A new option "--errors" is introduced, which can change the parser failure type from 'String' to a record type.
It simplifies implementing options that require a checked argument like '--mode=mode1|mode2|mode3'. Such option will be added in the following commit.
A new option "--errors" is introduced, which can change the parser failure type from 'String' to a record type.
It simplifies implementing options that require a checked argument like '--mode=mode1|mode2|mode3'. Such option will be added in the following commit.
A new option "--errors" is introduced, which can change the parser failure type from 'String' to a record type.
New options are introduced: "--structured-errors" and "--string-errors". They can specify the parser failure type.
Hello!
BNFC errors in the Haskell backend are plain
String
values like this:syntax error at line 3, column 1 before `token'
. There are some inconveniences here:The new error type might be like:
In fact, it might be more complex, since BNFC can also generate lexer errors, and we might want to support the
Text
type.Since this is a breaking change, a new command line option might be introduced, like
--error-type=(string|record)
, defaulting to theString
errors.Would you agree with this change? I would appreciate if you give some advice. I'm using BNFC in production and we need good error messages. It will be perfect if I create a pull request that will be accepted finally, otherwise I'm going to patch BNFC locally.
The text was updated successfully, but these errors were encountered: