#tree-sitter #incremental #parser #syntax-tree #applesoft

tree-sitter-applesoft

applesoft grammar for the tree-sitter parsing library

12 stable releases (4 major)

4.0.0 Jul 27, 2024
3.2.1 May 12, 2024
3.2.0 Apr 21, 2024
3.1.1 May 28, 2023
0.0.1 Nov 28, 2021

#107 in Text editors

Download history 6/week @ 2024-07-04 151/week @ 2024-07-25 23/week @ 2024-08-01 15/week @ 2024-08-08 7/week @ 2024-08-15 1/week @ 2024-08-22 9/week @ 2024-09-12 33/week @ 2024-09-19 24/week @ 2024-09-26 7/week @ 2024-10-03

65 downloads per month
Used in 2 crates (via a2kit)

MIT license

515KB
21K SLoC

C 20K SLoC // 0.0% comments JavaScript 423 SLoC // 0.1% comments Scheme 121 SLoC Rust 33 SLoC // 0.1% comments

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 = "4.0.0"

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.

Dependencies

~2.7–4MB
~73K SLoC