The Tree Sitter grammar here is ONLY to produce tokens for the purpose of syntax highlighting a Technique file in the the Zed Editor. It is not a complete parser to a full abstract syntax tree.
The Technique compiler's command-line program has been taught to code format
input source files with the format
subcommand:
technique format -R Example.tq
(where -R
is to ensure raw ANSI escape code are generated even if output is
redirected). The requirement is that other editors' syntax highlighting
matches the output of the format subcommand, which is authoritative for
colouring.
The sequence of commands to iterate on this grammar is:
$ tree-sitter generate
$ tree-sitter parse Example.tq
$ tree-sitter highlight Example.tq
You will also need a ~/.config/tree-sitter/config.json file with content along the lines of:
where ~/src/technique-lang/ contains the checkout of this repository. A sample config file is in the config/ directory here, which also includes the default colour palette used for rendering Technique files correctly.