Elm-tree-sitter implementation

#1

I think my implementation is finally at a stage where I can share it. Even if it might not be useful to most people here :slight_smile:

Why am I doing this?

I believe that Elm would greatly benefit from better tooling, the ultimate goal is to write a language server integration. This is a possible building block for that.

What it brings to the table:

  • Very fast parsing, should enable parsing on each keystroke
  • Resilient, even if you use wrong syntax, most of the file should still be recognized alright
  • Should also be useful to the elm atom maintainers, as atom is using tree sitter as the new default for code highlighting (our ast might be too expressive). Highlight implementation still needs to be done if wanted.

What is this tested with?

This is tested against the tests included in the repo and:

So it should work fine for a fair amount of code. What’s not tested right now is behavior in error cases.

Thanks

Very very big thanks goes out to @klazuka and the people of intellij-elm as I basically stole how they’re creating their parser minus the GLSL implementation.

25 Likes
#2

Hi Razee can you explain what a tree sitter is and why I should care/want to use it?

#3

Well, you probably shouldn’t care about this unless:

  • You want to write IDE integration/s or an language server provider
  • Parse elm syntax in some form
  • Are maintaining an atom plugin for elm
1 Like
#4

There is an interesting talk motivating the use of tree sitters for atom.

closed #5

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.