How to build the Rust implementation of tree-sitter
$ sudo ./script/build-wasm
(Note just running the script might go wrong due to the permission error when it attempts to access the docker.)
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
(This installs rustc, the latest rust compiler at ~/.cargo as guided in https://rustup.rs/.)
$ source ~/.cargo/env
(This activates the path of the installed rust toolchains.)
$ cargo build
(This builds tree-sitter with the installed rust toolchains. With no option to the build mode, tree-sitter is built in a debug mode that provides various debug options. Alternatively, one can give --release to the build mode for a release.)
How to run tree-sitter, say, over tree-sitter-python?
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
- export TREE_SITTER=/home/khchoi/work/lang/tree-sitter/tree-sitter/target/debug/tree-sitter
- export TREE_SITTER=/home/khchoi/work/lang/tree-sitter/tree-sitter/target/release/tree-sitter