Yuan Fu writes: >> On Dec 27, 2022, at 8:44 AM, Philip Kaludercic wrote: >> >> Stefan Monnier writes: >> >>>> It doesn't need any project, it is literally two command lines. >>>> Here's an example: >>>> >>>> gcc -O2 -I. -c -o parser.o parser.c >>>> gcc -shared parser.o scanner.o -ltree-sitter -o libtree-sitter-c-sharp.dll >>> >>> AFAIK `parser.c` is a file generated from the actual grammar's source, >>> itself written in Javascript. >>> >>> So the above instructions are akin to downloading a precompiled binary >>> and installing it. While it is the most convenient path for the >>> end-users, it's important w.r.t Freedom to make sure that grammars can >>> also be regenerated from source by the end users. >> >> I have asked the question before, but freedom or not, the above is a >> nuisance to run for every language. If the process is as automatic as >> the above example demonstrates, shouldn't Emacs have a command to take a >> grammar and compile+install it? I guess this could be more complicated >> if the grammar is generated using a custom tool-chain for each language >> (or is it always Javascript?), but nothing impossible. > > Though the magic of programming, such command now exists: treesit-install-language-grammar. It needs recipes to work, though. The recipe would involve https://github.com, which I guess is probably too heretical to include in Emacs source, so I left the recipes empty. I tested the install command with these recipes: > > (setq treesit-language-source-alist > '((python "https://github.com/tree-sitter/tree-sitter-python.git") > (typescript "https://github.com/tree-sitter/tree-sitter-typescript.git" > "typescript/src" "typescript"))) > > Yuan If acceptable, it looks good. I could imagine that it should be OK if we point to GitHub, since we are just using it as a Git host. Here are a few suggestions