Skip to content

koto-lang/tree-sitter-koto

Repository files navigation

tree-sitter-koto

Tree-sitter parser for Koto.

Current State

The parser is mostly usable, but there are some bugs that result in valid Koto expressions not being correctly processed.

Contributions would be very welcome! See the failing tests for a couple of examples of expressions that could be worked on.

Development

The justfile contains some commands that are useful during development, in particular just test which will generate the tree-sitter parser from grammar.js and then run the tests contained in test/corpus.

just watch test will re-run just test when files are updated.

Arguments can be passed to just watch test, e.g. just watch test --debug -f identifiers will generate the parser with debug logging enabled, and then run only the identifiers test.

src/scanner.c contains the external scanner used by the grammar, handling some of the more complex aspects of parsing Koto code. Debug logging for the scanner can be enabled via a preprocesser definition at the top of the file.