2 个版本 (1 个稳定版)
1.0.0 | 2023 年 7 月 15 日 |
---|---|
0.0.1 | 2023 年 3 月 7 日 |
#203 in #incremental
390KB
12K SLoC
tree-sitter-uxntal
此crate提供了一个为tree-sitter解析库的Uxn Tal汇编语法。要使用此crate,将其添加到您的[dependencies]
部分的Cargo.toml
文件中。(请注意,您可能还需要依赖tree-sitter
crate,以便以任何有用的方式使用解析结果。)
[dependencies]
tree-sitter = "~0.20.9"
tree-sitter-uxntal = "1.0.0"
通常,您将使用language函数将此语法添加到tree-sitter Parser中,然后使用解析器解析一些代码
let code = r#"
|0100 ( init )
;hello-word ;print-text JSR2
BRK
@print-text ( str* -- )
&while
( send ) LDAk #18 DEO
( loop ) INC2 LDAk ,&while JCN
POP2
JMP2r
"#;
let mut parser = Parser::new();
parser.set_language(tree_sitter_uxntal::language()).expect("Error loading Uxntal grammar");
let parsed = parser.parse(code, None);
如果您有任何问题,请在tree-sitter 讨论页上联系我们。
依赖关系
~2.8–4MB
~72K SLoC