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

Mechanism for finding out where an error started and context around said error #833

Open
resolritter opened this issue Dec 5, 2020 · 1 comment
Labels
enhancement Feature request

Comments

@resolritter
Copy link

From #831 (comment)

I think the biggest downside to using a Tree-sitter parser in a compiler front-end is that, while we've done a lot of work on Tree-sitter's error recovery, we haven't yet built out functionality for error messages. So it isn't trivial to find out the exact token/position where the error initiated, and get a list of expected tokens, and things like that.

The proposed use-case in the linked discussion is being able to use the generated parser in the compiler front-end for a language. That being the scenario, continuing after the error is not necessary since code emission could stop at the first syntax error found.

What needs to be done

  • "Stop-at-first-error" mode
  • Error Context
    • The line and column where it started
    • List of constructs which are supposed to be in the error's position (semantic error)
    • List of tokens which were missing or were misplaced (grammatical error)
@razzeee
Copy link
Contributor

razzeee commented Dec 5, 2020

This has some intersection with #255

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

No branches or pull requests

4 participants