tree-sitter-python
tree-sitter-go
tree-sitter-python | tree-sitter-go | |
---|---|---|
5 | 4 | |
383 | 318 | |
3.4% | 2.5% | |
7.7 | 7.4 | |
11 days ago | 11 days ago | |
JavaScript | JavaScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
tree-sitter-python
- Emacs and Java Development: Corfu + Cape + LSP-Mode + Treesit
- Building tree-sitter languages for Emacs
-
what do you guys use treesitter for?
i dont see the issue reported in the python parser: https://github.com/tree-sitter/tree-sitter-python/issues
-
Custom treesitter python highlight for __dunder__ methods
How can we add different highlight for __dunder__ methods a.k.a. magic methods? Is there a TS highlight group for that? I know that in tree-sitter-python there is pythonTSConstructor for __init__ method that I can customize, but I couldn't figure out for other magic methods.
-
Emacs for Python 3.10
You could try elisp-tree-sitter as soon as this issue is closed.
tree-sitter-go
-
Mergiraf: a syntax-aware merge driver for Git
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...
-
Looking for EBNF / Antlr / yacc for Go with generics
Might the tree-sitter grammar at https://github.com/tree-sitter/tree-sitter-go help at all?
- Building tree-sitter languages for Emacs
-
Tree-sitter: an incremental parsing system for programming tools
Worth calling out that the syntax highlighting support is used to highlight several languages in github.com. (Linguist is still used for the long tail of languages, but we plan to migrate more and more over to tree-sitter-based highlighting over time.)
The query language is also what's used to drive the fuzzy/ctags-like Code Navigation feature. Both of those are powered by tree-sitter query files defined in each language's repo, like these for Go: https://github.com/tree-sitter/tree-sitter-go/tree/master/qu...
What are some alternatives?
tree-sitter-rust - Rust grammar for tree-sitter
elisp-tree-sitter - Emacs Lisp bindings for tree-sitter
lsp-mode - Emacs client/library for the Language Server Protocol
Moose - MOOSE - Platform for software and data analysis.
tree-sitter-c-sharp - C# Grammar for tree-sitter
tree-sitter-haskell - Haskell grammar for tree-sitter.
tree-sitter-typescript - TypeScript grammar for tree-sitter
tree-sitter - An incremental parsing system for programming tools
tree-sitter-vue - Vue grammar for tree-sitter
nvim-treesitter - Nvim Treesitter configurations and abstraction layer
tree-sitter-zig - Tree-sitter package for the Zig programming language
tree-sitter-kotlin - Kotlin grammar for Tree-sitter