tree-sitter-applesoft

Crates.iotree-sitter-applesoft
lib.rstree-sitter-applesoft
version3.2.1
sourcesrc
created_at2021-11-28 17:02:40.705954
updated_at2024-05-12 11:26:58.7009
descriptionapplesoft grammar for the tree-sitter parsing library
homepagehttps://github.com/dfgordon/tree-sitter-applesoft
repositoryhttps://github.com/dfgordon/tree-sitter-applesoft
max_upload_size
id488893
size650,813
(dfgordon)

documentation

README

Parser for Applesoft BASIC

This is the rust binding for tree-sitter-applesoft. To use the parser, include the following in your package's Cargo.toml:

[dependencies]
tree-sitter = "0.22.4"
tree-sitter-applesoft = "3.2.1"

Here is a trivial main.rs example:

use tree_sitter;
use tree_sitter_applesoft;

fn main() {
    let code = "10 GOTO 10\n";
    let mut parser = tree_sitter::Parser::new();
    parser.set_language(&tree_sitter_applesoft::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

(source_file (line (linenum) (statement (tok_goto) (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.

Commit count: 58

cargo fmt