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

refactor: switch to nom-based parser #173

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

CertainLach
Copy link
Owner

@CertainLach CertainLach commented Jul 5, 2024

I want to use some code analysis for the optimizations for a long time, but peg-based parser is not flexible enough for that.
While the long-term plan is to finish rowan parser, I still want to have a faster alternative parser for AST (Rowan is best for CST).
In this PR, I have replaced peg-based parser with nom-based rewrite, and created a prototype analyzer, on which logic the real one will be based.

Commits will be split, some changed will be split into other PRs too, this is just a draft/PoC.

This parser also allows to quickier experimentation on language features, better syntax feature-gating (which was lacking for null-coalesce/destruction), better control over AST structures layout (I like the expression structure from rowan-based parser better, and this PR brings it partially).

It also implements numberic separators as proposed here: google/jsonnet#1155, but I'll probably port this to peg in the meantime.

@JarvisCraft JarvisCraft self-requested a review July 5, 2024 19:56
@CertainLach
Copy link
Owner Author

TODO:

  • Replace string-based input with lexer made for rowan-parser
  • If is not possible to use lexer from rowan-parser, then try to make Input automatically eat whitespace with mini-lexer (Whitespace handling in this PR is not good)

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

Successfully merging this pull request may close these issues.

1 participant