This is a parser for Integer BASIC intended for use with language servers. It is built using the Tree-sitter system. The native parser is a C library. Bindings are possible for several languages, but only the rust crate is actively maintained. There is a node package that can be updated upon request.
For details on parser usage and design see the wiki.
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 and token_list.txt as inputs. Important: the metaprogram also creates test code. This test code would be painful to create by hand.
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.
The build.py script takes care of all of the above steps, and runs the tests. It produces a case insensitive parser, but can be easily modified to produce a case sensitive one.
- Apple II Reference Manual, 1978
- Integer BASIC disassembly