1 unstable release

0.1.0 Apr 23, 2023
0.0.0 Mar 29, 2022

#15 in #lox

Download history 4/week @ 2025-02-05 43/week @ 2025-02-19 4/week @ 2025-02-26 8/week @ 2025-03-05 29/week @ 2025-03-26 108/week @ 2025-04-02 31/week @ 2025-04-09 1206/week @ 2025-04-16 349/week @ 2025-04-23 357/week @ 2025-04-30 1129/week @ 2025-05-07 650/week @ 2025-05-14 313/week @ 2025-05-21

2,464 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

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();

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

Dependencies

~2.8–4MB
~75K SLoC