JavaScript tree-sitter

Open-source JavaScript projects categorized as tree-sitter

Top 23 JavaScript tree-sitter Projects

tree-sitter
  1. tree-sitter-typescript

    TypeScript grammar for tree-sitter

    Project mention: Swc4j: SWC for Java | news.ycombinator.com | 2025-01-03

    HTH

    0 - https://tree-sitter.github.io/tree-sitter/

    1 - https://github.com/tree-sitter/tree-sitter-typescript

  2. SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
  3. tree-sitter-python

    Python grammar for tree-sitter

  4. tree-sitter-javascript

    Javascript grammar for tree-sitter

    Project mention: Swc4j: SWC for Java | news.ycombinator.com | 2025-01-03

    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...

  5. tree-sitter-rust

    Rust grammar for tree-sitter

  6. tree-sitter-go

    Go grammar for tree-sitter

    Project mention: Mergiraf: a syntax-aware merge driver for Git | news.ycombinator.com | 2024-11-09

    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...

  7. tree-sitter-cpp

    C++ grammar for tree-sitter

    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.

  8. tree-sitter-c

    C grammar for tree-sitter

  9. tree-sitter-elixir

    Elixir grammar for tree-sitter

  10. tree-sitter-c-sharp

    C# Grammar for tree-sitter

  11. tree-sitter-java

    Java grammar for tree-sitter

  12. tree-sitter-sql

    SQL grammar for tree-sitter

  13. tree-sitter-php

    PHP grammar for tree-sitter

  14. tree-sitter-scala

    Scala grammar for tree-sitter

  15. tree-sitter-swift

    A tree-sitter grammar for the Swift programming language.

    Project mention: Show HN: Tree-sitter Integration for Swift | news.ycombinator.com | 2024-08-20

    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.

  16. tree-sitter-json

    JSON grammar for tree-sitter

  17. tree-sitter-kotlin

    Kotlin grammar for Tree-sitter

  18. tree-sitter-hyprlang

    hyprlang grammar for tree-sitter

  19. tree-sitter-vimdoc

    Tree-sitter parser for Vim help files

  20. tree-sitter-sql

    SQL syntax highlighting for tree-sitter (by m-novikov)

  21. tree-sitter-css

    CSS grammar for Tree-sitter

  22. tree-sitter-yaml

    YAML grammar for tree-sitter

  23. tree-sitter-vue

    Vue grammar for tree-sitter

  24. tree-sitter-regex

    Tree-sitter parser for regular expressions

NOTE: The open source projects on this list are ordered by number of github stars. The number of mentions indicates repo mentiontions in the last 12 Months or since we started tracking (Dec 2020).

JavaScript tree-sitter discussion

Log in or Post with

JavaScript tree-sitter related posts

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

Sponsored
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com

Did you know that JavaScript is
the 3rd most popular programming language
based on number of references?