https://github.com/dfgordon/tree-sitter-applesoft
Parser for Applesoft BASIC
https://github.com/dfgordon/tree-sitter-applesoft
Last synced: 2 months ago
JSON representation
Parser for Applesoft BASIC
- Host: GitHub
- URL: https://github.com/dfgordon/tree-sitter-applesoft
- Owner: dfgordon
- License: mit
- Created: 2021-10-31T15:22:39.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-08-03T20:36:34.000Z (10 months ago)
- Last Synced: 2025-11-10T06:13:43.614Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 559 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: .github/README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Parser for Applesoft BASIC

This is a parser for Applesoft BASIC intended for use with language servers. It is built using the [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) system. The native parser is a C library. Bindings are possible for several languages, but only the [rust crate](https://crates.io/crates/tree-sitter-applesoft) is actively maintained. There is a [node package](https://www.npmjs.com/package/tree-sitter-applesoft) that can be updated upon request.
For details on parser usage and design see the [wiki](https://github.com/dfgordon/tree-sitter-applesoft/wiki).
## Pre-Build Process
If you are changing the grammar, be aware the file `grammar.js` is actually generated by the metaprogram `token_processor.py`. This takes `grammar-src.js`, `scanner-src.c`, and `token_list.txt` as inputs.
## Build Process
Once you have `grammar.js` you run `tree-sitter generate` to produce `src/parser.c` and, in turn, the bindings for whatever languages are specified in `tree-sitter.json`. If you want to compile a WASM parser you can follow up with `tree-sitter build -w`.
## Build Script
The `build.py` script takes care of all of the above steps, and will also run the tests. It produces a case insensitive parser, but can be easily modified to produce a case sensitive one. It can be adjusted to either accept or not accept extended `CALL` syntax.
## References
1. Applesoft BASIC Programmer's Reference Manual - Volume 1
2. Applesoft BASIC Programmer's Reference Manual - Volume 2