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

WIP: [parsers] Add tree-sitter POC #457

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

Conversation

forivall
Copy link

@forivall forivall commented Nov 9, 2019

At the very least, this is waiting on tree-sitter/tree-sitter#481 to be merged and released, so the patch-package hackage can be removed.

Very POC, requesting feedback. As tree-sitter's parsing internals are written in C, this requires some changes to get the WASM binary to load, so feedback on that in particular would be appreciated.

@fkling
Copy link
Owner

fkling commented Nov 9, 2019

So, am I correctly understanding that this is the JavaScript parser generated by tree sitter?
I see that it supports various languages. Does that mean we could also add a parser for e.g. Bash?

The incremental stuff sounds interesting! Will have to look into that some more at some point.

@forivall
Copy link
Author

forivall commented Nov 10, 2019

Exactly, yes, this is the JavaScript parser that tree-sitter generates (from tree-sitter-javascript). I wanted to see what the structure its JavaScript AST looked like and see if it's ESTree or not, and the best way i thought of was to submit it here, then other people can look at how tree-sitter works! And yes, this means we can add parsers for whichever languages tree-sitter can parse.

For the incremental stuff to work fully, it looks like we have to notify the tree-sitter internals about the edits (see the docs and their playground's code, which, like astexplorer, uses codemirror), but getting that to work would take additional changes to astexplorer's redux-saga data model, and i just didn't have time for that then.

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.

2 participants