Remix.run Logo
eager_noob an hour ago

Iterating through and evaluating possible approaches for shrinking the binary size of a tree-sitter based Vi/Vim compatible tags generator I am developing without affecting the developer experience for adding support for newer languages[1]. A couple of approaches have already been tried and failed to live up to the expectations on developer experience [2][3]. Next in line is to look into bundling only the tree-walking code for all supported languages with tree-tags and allow the user to configure the grammars to download separately from the main binary, possibly using the `wasm` feature which allows native library to run wasm compiled grammars.

[1] https://github.com/jha-naman/treetags

[2] https://github.com/jha-naman/treetags/pull/62

Tried to use a generator for automating the bulk of the scanner for a language from `grammar.json` file of a tree-sitter grammar. A runtime engine uses the scanner for a forward only walk on the scanned code and calls the hooks to generate tags.

[3] https://github.com/jha-naman/treetags/pull/56

A complicated mess of a generator that takes a few declarative inputs and tries to generate code for spitting out tags for a given language.