12 unstable releases (3 breaking)

0.23.2 Nov 24, 2024
0.23.0 Sep 2, 2024
0.21.2 Apr 25, 2024
0.20.4 Aug 18, 2023
0.19.0 Mar 4, 2021

#11 in Parser tooling

Download history 13040/week @ 2024-10-09 17180/week @ 2024-10-16 14813/week @ 2024-10-23 15578/week @ 2024-10-30 13624/week @ 2024-11-06 15208/week @ 2024-11-13 16569/week @ 2024-11-20 18234/week @ 2024-11-27 21539/week @ 2024-12-04 25124/week @ 2024-12-11 14783/week @ 2024-12-18 7232/week @ 2024-12-25 15747/week @ 2025-01-01 42444/week @ 2025-01-08 35455/week @ 2025-01-15 23845/week @ 2025-01-22

118,658 downloads per month
Used in 86 crates (67 directly)

MIT license

6MB
198K SLoC

C 196K SLoC // 0.0% comments JavaScript 1.5K SLoC // 0.0% comments Scheme 164 SLoC // 0.1% comments Rust 30 SLoC

tree-sitter-rust

CI discord matrix crates npm pypi

Rust grammar for tree-sitter.

Features

  • Speed — When initially parsing a file, tree-sitter-rust takes around two to three times as long as rustc's hand-written parser.

    $ wc -l examples/ast.rs
      2157 examples/ast.rs
    
    $ rustc -Z unpretty=ast-tree -Z time-passes examples/ast.rs | head -n0
      time:   0.002; rss:   55MB ->   60MB (   +5MB)  parse_crate
    
    $ tree-sitter parse examples/ast.rs --quiet --time
      examples/ast.rs    6.48 ms        9908 bytes/ms
    

    But if you edit the file after parsing it, tree-sitter can generally update the previous existing syntax tree to reflect your edit in less than a millisecond, thanks to its incremental parsing system.

References

Dependencies