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

#13 in Parser tooling

Download history 17648/week @ 2024-11-22 19575/week @ 2024-11-29 22646/week @ 2024-12-06 24011/week @ 2024-12-13 8667/week @ 2024-12-20 8817/week @ 2024-12-27 23087/week @ 2025-01-03 51662/week @ 2025-01-10 26797/week @ 2025-01-17 28988/week @ 2025-01-24 33408/week @ 2025-01-31 41541/week @ 2025-02-07 29845/week @ 2025-02-14 31515/week @ 2025-02-21 34288/week @ 2025-02-28 29924/week @ 2025-03-07

132,485 downloads per month
Used in 101 crates (77 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