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

Parser V2 #40

Open
jprochazk opened this issue Jul 9, 2023 · 0 comments
Open

Parser V2 #40

jprochazk opened this issue Jul 9, 2023 · 0 comments

Comments

@jprochazk
Copy link
Owner

jprochazk commented Jul 9, 2023

Theres a few things about the current parser which make it not as nice as it could be. Specifically:

  • It is not very resilient (only best-effort, using the sync helper on the parser to discard tokens in an attempt to return to a potentially good state)
  • The indentation tracking machinery made it hard to implement semicolons
  • The error handling mechanism is not great, because there's a distinction between "collect all errors" and "propagate this one error up"
  • Spans are not associated with their source files/strings. Ideally spans would also be interned, as they currently take up quite a bit of space.

I think the issues are only going to become more exaggerated as we add features (match, do, with, postfix if/for, etc.), so before we start doing that, it's probably a good idea to do an overhaul of the parser while it's still this simple.

I think this post by matklad has excellent has ideas, and we should follow it when writing a new parser.

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