Rust impl of treesitter 'LR -> incremental parser' algorithm?

  1. I understand that TreeSitter has many grammars, ex: GitHub - tree-sitter/tree-sitter-rust: Rust grammar for tree-sitter

  2. I understand that TreeSitter has many bindings, ex: tree-sitter/lib/binding_rust at master · tree-sitter/tree-sitter · GitHub

  3. I understand that TreeSitter converts 'grammars' expressed as json into a C parser:

tree-sitter-rust/grammar.json at master · tree-sitter/tree-sitter-rust · GitHub
tree-sitter-rust/node-types.json at master · tree-sitter/tree-sitter-rust · GitHub

tree-sitter-rust/parser.c at master · tree-sitter/tree-sitter-rust · GitHub
tree-sitter-rust/scanner.c at master · tree-sitter/tree-sitter-rust · GitHub


  1. Question: this step of "grammar (as json or something else)" -> "incremental parser" -- is there a Rust implementation of this algorithm ?

You seem to be looking for a parser generator. I think one of the most well-known Rust parser generators is LALRPOP. I don't know if that can give you an incremental/streaming parser though.

I don't know if that can give you an incremental/streaming parser though.

LL(k), LR(k), and LALR (a specific form of LR) are parsing algorithms.

Incremental and streaming features for parsers are largely independent of that.
So whether or not those are supported is dependent on whether they wrote it that way or not.

Although related, I am not looking for parser generator in general. I am looking for something similar to tree-sitter in particular, i.e. the "incremental" aspect which allows fast enough re-parse to run it on every keystroke.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.