This repository contains the code used to parse the Matry language. It uses tree-sitter, which is tool for generating both parsers and highlighters that can be applied incrementally.
The grammar produces bundles in both NodeJS and Rust.
- Clone this repo
- Download the tree-sitter CLI
The /grammar.js
file provides the syntax definition for Matry.
To update the syntax...
- Update
/grammar.js
- Navigate to the repo in your terminal:
cd /local/path/to/tree-sitter-matry
- Run the generate command:
tree-sitter generate
All tests are located in /test/corpus
.
Documentation for tree-sitter tests can be found here.
- Run the tests:
tree-sitter test
- Run a particular test:
tree-sitter test -f 'Your test name'
Matry is intended to be exported either as a WASM or NodeJS module.
For WASM:
- Run the build command:
tree-sitter build-wasm
- You should see a new
tree-sitter-matry.wasm
file in the root directory - do NOT commit this file. - Copy it into your project and use according to general WASM documentation.
For NodeJS:
- Run the build command:
npm run build
- Link this repo to your working repo using
npm link