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

Make parser more accepting #57

Open
uncomputable opened this issue Jul 9, 2024 · 1 comment
Open

Make parser more accepting #57

uncomputable opened this issue Jul 9, 2024 · 1 comment

Comments

@uncomputable
Copy link
Collaborator

Parse errors are hard to understand. These errors come directly from the PEST grammar, which no Simfony developer will have read. It would be better to accept incomplete program components during parsing and to produce an expressive user-facing error when the AST is generated.

#56 (comment)

Like, right now if you remove type annotations from your example programs you get something like expected match_pattern but it'd be nicer if we'd parse these things, mark them as "unknown type" and then during AST conversion we'd give the user an error like "No type was specified for x. You need to provide a type annotation, like x: bool."

The scope of this change is unclear, but grammar errors are hard to understand so we never want to show them to users.

@apoelstra
Copy link
Contributor

Well, not never. If they input actual nonsense we don't have much choice. But if they write something that "looks like it should work" then we should try to provide our own error message.

For the sake of making this issue closeable, I'd say that if you can remove the type annotations (especially the ::<u8> ones) and the resulting error message tells you to put them back, I'd call this issue closed. But in general, we should strive toward doing this in many different places.

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

2 participants