Skip to content


Repository files navigation


CI discord matrix crates npm pypi

Rust grammar for tree-sitter.


  • 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/
      2157 examples/
    $ rustc -Z unpretty=ast-tree -Z time-passes examples/ | head -n0
      time:   0.002; rss:   55MB ->   60MB (   +5MB)  parse_crate
    $ tree-sitter parse examples/ --quiet --time
      examples/    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.