grain
grain copied to clipboard
feat: Generate tree-sitter grammar from parser
This is my initial experimentation to figure out if we can use MenhirSdk
and the cmly
file it can generate to automatically output a tree-sitter grammar.
It's a little annoying because you need to specify the RegExp pattern for each token in the parser, as that logic is actually done by sedlex_ppx in the lexer, but tree-sitter generates a combined lexer/parser given a JavaScript RegExp 😦.
If we can actually get this working, we could possibly throw away all our formatter code and just rely on Topiary.