Subject: Re: bug#61849: 29.0.60; Unable to use treesit-install-language-grammar because repo doesn't have parser.c

From: Eli Zaretskii <[email-masked]>
Date: Tue, 21 Mar 2023 05:27:50 +0200

> Date: Mon, 20 Mar 2023 22:01:15 +0000
> From: Gregory Heytings <[email-masked]>
> cc: Dmitry Gutov <[email-masked]>, [email-masked], [email-masked], 
>     [email-masked]
> 
> 
> >> Suppose the repositories remove the generated grammar files. What would 
> >> be sufficient for us to regenerate them?
> >
> > I hope someone will write a generation tool in Emacs Lisp.
> >
> 
> That can't possibly happen, IMO.  Generating the grammar.json files from 
> the grammar.js files with an Emacs Lisp program would amount to implement 
> a JavaScript interpreter in Emacs Lisp.

So you are saying that generating a parser would need a JavaScript
interpreter as part of the generation?  Does tree-sitter-cli tool
invoke it, then (I didn't study its sources)?

> And generating the parser.c files from the grammar.json files would
> amount to reimplement the generator, which is about 13500 lines of
> non-trivial Rust code, in Emacs Lisp.

That's what I hoped someone will do, yes.  It's a non-trivial job, but
surely isn't impossible.  Reimplementing that in some other widely
available language, like Python or Perl, would also do.  Or maybe the
Rust front-end to GCC will become available soon enough.  Or something.