GNU bug report logs - #61849
29.0.60; Unable to use treesit-install-language-grammar because repo doesn't have parser.c

Previous Next

Package: emacs;

Reported by: Misha Zharov <mishazharov1 <at> gmail.com>

Date: Mon, 27 Feb 2023 19:48:02 UTC

Severity: normal

Found in version 29.0.60

Full log


View this message in rfc822 format

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: mishazharov1 <at> gmail.com, casouri <at> gmail.com, 61849 <at> debbugs.gnu.org, dgutov <at> yandex.ru
Subject: bug#61849: 29.0.60; Unable to use treesit-install-language-grammar because repo doesn't have parser.c
Date: Tue, 21 Mar 2023 09:39:31 +0000
>> 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?
>

Yes.

>
> Does tree-sitter-cli tool invoke it, then (I didn't study its sources)?
>

Yes, here: https://github.com/tree-sitter/tree-sitter/blob/master/cli/src/generate/mod.rs#L169.

>> 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.
>

It's not impossible, but what would be the benefit (and/or incentive) of 
doing that?  Rust is already widely available, under a liberal licence, 
and it is also not necessary to create the parser.c file, which is 
architecture-independent, on the computer on which it is compiled.  Also 
note that generating the parser.c file can use _a lot_ of resources, e.g. 
generating the parser.c file of tree-sitter-c-sharp from the grammar.json 
file uses 40 (fourty!) GB of memory and takes several minutes.  I'll let 
you imagine what these numbers would be with an interpreted language like 
Elisp, Python or Perl.





This bug report was last modified 83 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.