SaaSHub helps you find the best software and product alternatives Learn more →
Top 23 JavaScript tree-sitter Projects
-
HTH
0 - https://tree-sitter.github.io/tree-sitter/
1 - https://github.com/tree-sitter/tree-sitter-typescript
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
-
-
I get the sense that treesitter is more for syntax highlighting than for real parsing, since I raised this issue[0] a while ago and I don't think anyone's really interested in it (not really interested enough myself in tree-sitter to see if it can be fundamentally solved; solving it involves making almost all production rules in the grammar parametric over two booleans).
Admittedly I haven't tested the TypeScript treesitter grammar, but I'd be surprised if the issue is fixed there. I've put together a sample file[1] that demonstrates various cases of these context dependencies. If I remember correctly, Sublime's highlighter was the best at handling these cases out of various editors I tried, though it still failed at some of the ones at the bottom involving multi-line function expressions within object literal keys. GitHub/gist uses treesitter, so you'll notice that sometimes the "REGEX" and "DIVISION" blocks are inconsistently coloured, but a correct parser should associate a colour consistently to them. Not demonstrated here, but inserting a multi-line comment in a file that is parsed incorrectly will throw the entire thing off.
[0] https://github.com/tree-sitter/tree-sitter-javascript/issues...
[1] https://gist.github.com/Maxdamantus/a11b41675fcde25ffc9b7ef0...
-
-
I don't think that different algorithms are better for merging or diffing. In both cases, the first step is to match identical nodes, and the quality of the final result depends heavily on this step. The main problem with GumTree is that it is a greedy algorithm. One incorrectly matched node can completely screw up the rest of the matches. A typical example we encountered was adding a decorator to a function in Python. When other functions with the same decorator followed, the algorithm would often map the newly added decorator to an existing decorator, causing all other decorator mappings to be "off-by-one". GumTree has a tendency to come up with more changes than there actually are.
We try to really get the diff quality nailed down before going after merges. We don't have merge functionallity in SemanticDiff yet.
The main issue we have with tree-sitter is that the grammars are often written from scratch and not based on the upstream grammar definition. Sometimes they only cover the most likely cases which can lead to parsing errors or incorrectly parsed code. When you encounter parsing errors it can be difficult to fix them, because the upstream grammar is structured completely different. To give you an example, try to compare the tree-sitter Go grammar for types [1] with the upstream grammar [2]. It is similar but the way the rules are structured is somewhat inverted.
We use separate executables for the parsers (this also helps to secure them using seccomp on Linux), and they all use the same JSON schema for their output. This allows us to write the parser executable in the most appropriate language for the target language. Building all them statically and cross-platform for our VS Code extension isn't easy though ;)
[1]: https://github.com/tree-sitter/tree-sitter-go/blob/master/gr...
-
Project mention: Difftastic, a structural diff tool that understands syntax | news.ycombinator.com | 2024-03-21
Grammar page (https://github.com/tree-sitter/tree-sitter-cpp) reference two documents at the very end:
- Hyperlinked C++ BNF Grammar (https://alx71hub.github.io/hcb/)
- EBNF Syntax: C++ (ISO/IEC 14882:1998(E)) https://www.externsoft.ch/download/cpp-iso.html
The second doc has a year in the title, so it's ancient af.
-
-
-
-
-
-
-
-
Seems to me this is a case of the Sesame Street song, "Which one of these things is not like the other ones?"
There's bindings for Swift, a parser for Swift source, and this utility kit for Swift:
- Tree-Sitter Bindings for Swift provides the foundational tools to use tree-sitter’s parsing capabilities in Swift: https://github.com/ChimeHQ/SwiftTreeSitter
- Tree-Sitter Parser for Swift is a specific implementation that allows tree-sitter to parse Swift code: https://github.com/alex-pinkus/tree-sitter-swift
- Tree-Sitter Kit is a higher-level toolkit that simplifies creating and using tree-sitter parsers in Swift, providing a more integrated and Swift-friendly approach to defining and working with grammars and parsed data structures: https://github.com/daspoon/tree-sitter-kit
This Tree-Sitter Kit looks like a convenience layer on top of the tree-sitter system, designed to work smoothly within Swift, making the process of creating and using parsers more straightforward and idiomatic within the Swift language itself.
-
-
-
-
-
-
-
-
-
JavaScript tree-sitter discussion
JavaScript tree-sitter related posts
-
Swc4j: SWC for Java
-
Types are the basic tool of software design
-
How to support indentation of Haskell with Helix?
-
Let's write an Emacs treesitter major mode
-
How to extend treesitter SQL highlighting with custom keywords?
-
How to Get Started with Tree-Sitter
-
How to make `goto_next_test` and `goto_prev_test` work?
-
A note from our sponsor - SaaSHub
www.saashub.com | 19 Jan 2025
Index
What are some of the best open-source tree-sitter projects in JavaScript? This list will help you:
# | Project | Stars |
---|---|---|
1 | tree-sitter-typescript | 396 |
2 | tree-sitter-python | 393 |
3 | tree-sitter-javascript | 376 |
4 | tree-sitter-rust | 372 |
5 | tree-sitter-go | 325 |
6 | tree-sitter-cpp | 284 |
7 | tree-sitter-c | 253 |
8 | tree-sitter-elixir | 250 |
9 | tree-sitter-c-sharp | 205 |
10 | tree-sitter-java | 169 |
11 | tree-sitter-sql | 165 |
12 | tree-sitter-php | 160 |
13 | tree-sitter-scala | 160 |
14 | tree-sitter-swift | 146 |
15 | tree-sitter-json | 140 |
16 | tree-sitter-kotlin | 133 |
17 | tree-sitter-hyprlang | 129 |
18 | tree-sitter-vimdoc | 114 |
19 | tree-sitter-sql | 112 |
20 | tree-sitter-css | 97 |
21 | tree-sitter-yaml | 96 |
22 | tree-sitter-vue | 77 |
23 | tree-sitter-regex | 77 |