11 unstable releases (3 breaking)

new 0.23.1 Nov 10, 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

#9 in Parser tooling

Download history 12794/week @ 2024-07-28 12515/week @ 2024-08-04 12562/week @ 2024-08-11 14028/week @ 2024-08-18 13317/week @ 2024-08-25 15029/week @ 2024-09-01 13214/week @ 2024-09-08 11134/week @ 2024-09-15 14442/week @ 2024-09-22 13163/week @ 2024-09-29 14268/week @ 2024-10-06 15037/week @ 2024-10-13 15673/week @ 2024-10-20 14789/week @ 2024-10-27 15268/week @ 2024-11-03 12381/week @ 2024-11-10

59,035 downloads per month
Used in 76 crates (62 directly)

MIT license

6MB
194K SLoC

C 193K SLoC // 0.0% comments JavaScript 1.5K SLoC // 0.0% comments Scheme 162 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