This is the rust binding for tree-sitter-merlin6502. To use the parser, include the following in your package's Cargo.toml
:
toml
[dependencies]
tree-sitter = "0.20.6"
tree-sitter-merlin6502 = "2.0.0"
Here is a trivial main.rs
example:
```rust
use treesitter;
use treesitter_merlin6502;
fn main() { let code = " LDA #$00\n"; let mut parser = treesitter::Parser::new(); parser.setlanguage(treesittermerlin6502::language()) .expect("Error loading Merlin 6502 grammar"); let tree = parser.parse(code,None).unwrap();
println!("{}",tree.root_node().to_sexp());
}
This should print the syntax tree
(sourcefile (operation (oplda) (arglda (imm (immprefix) (num (hex))))))
```
For more on parsing with rust, see the general guidance here.