Skip to content

dfgordon/tree-sitter-integerbasic

Repository files navigation

Parser for Integer BASIC

unit tests

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.

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 and token_list.txt as inputs. Important: the metaprogram also creates test code. This test code would be painful to create by hand.

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 runs the tests. It produces a case insensitive parser, but can be easily modified to produce a case sensitive one.

References

  1. Apple II Reference Manual, 1978
  2. Integer BASIC disassembly

About

Parser for Integer BASIC

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors