This is the rust binding for tree-sitter-applesoft. To use the parser, include the following in your package's Cargo.toml
:
toml
[dependencies]
tree-sitter = "0.20.7"
tree-sitter-applesoft = "2.0.4"
Here is a trivial main.rs
example:
```rust
use treesitter;
use treesitter_applesoft;
fn main() { let code = "10 GOTO 10\n"; let mut parser = treesitter::Parser::new(); parser.setlanguage(treesitterapplesoft::language()) .expect("Error loading Applesoft grammar"); let tree = parser.parse(code,None).unwrap();
println!("{}",tree.root_node().to_sexp());
}
This should print the syntax tree
(sourcefile (line (linenum) (statement (tokgoto) (linenum))))
```
For more on parsing with rust, see the general guidance here.
For specific guidance on this parser, see the wiki.
For an example of a project that uses this library, see a2kit.