#lox #parser #incremental

tree-sitter-lox

Lox grammar for the tree-sitter parsing library

1 unstable release

0.1.0 Apr 23, 2023
0.0.0 Mar 29, 2022

#291 in Text editors

Download history 144/week @ 2024-01-01 213/week @ 2024-01-08 9/week @ 2024-02-19 18/week @ 2024-02-26 12/week @ 2024-03-04 7/week @ 2024-03-11 44/week @ 2024-04-01 29/week @ 2024-04-15

73 downloads per month
Used in loxcraft

MIT license

165KB
6.5K SLoC

C 6K SLoC JavaScript 151 SLoC // 0.1% comments Scheme 80 SLoC // 0.1% comments Rust 22 SLoC // 0.6% comments

tree-sitter-lox

Crates.io

A Lox grammar for the tree-sitter parsing library.

Local setup

Install tree-sitter-cli:

cargo install tree-sitter-cli

To generate bindings:

tree-sitter generate

To run tests:

tree-sitter test

References


lib.rs:

This crate provides Lox language support for the tree-sitter parsing library.

Typically, you will use the language function to add this language to a tree-sitter Parser, and then use the parser to parse some code:

let code = "";
let mut parser = tree_sitter::Parser::new();
parser.set_language(tree_sitter_lox::language()).expect("error loading Lox grammar");
let tree = parser.parse(code, None).unwrap();

Dependencies

~2.7–4MB
~71K SLoC