refactor: switch to nom-based parser #173
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.