From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings Newsgroups: gmane.emacs.bugs 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 Message-ID: <08b5f766dd8da3ea4835@heytings.org> References: <83jzzxatc2.fsf@gnu.org> <831qm4bws5.fsf@gnu.org> <83wn3d9onk.fsf@gnu.org> <83sfdz6x4b.fsf@gnu.org> <5b115222-e46c-fce6-3a32-94e31980c26f@yandex.ru> <83r0tj6uoz.fsf@gnu.org> <83o7om7phl.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9375"; mail-complaints-to="usenet@ciao.gmane.io" Cc: mishazharov1@gmail.com, casouri@gmail.com, 61849@debbugs.gnu.org, dgutov@yandex.ru To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 21 10:40:24 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1peYTf-0002Hy-Ga for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 21 Mar 2023 10:40:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1peYTP-0007Fe-Ib; Tue, 21 Mar 2023 05:40:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1peYTK-0007FC-GX for bug-gnu-emacs@gnu.org; Tue, 21 Mar 2023 05:40:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1peYTK-0000XK-7Y for bug-gnu-emacs@gnu.org; Tue, 21 Mar 2023 05:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1peYTJ-00037P-NI for bug-gnu-emacs@gnu.org; Tue, 21 Mar 2023 05:40:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Mar 2023 09:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61849 X-GNU-PR-Package: emacs Original-Received: via spool by 61849-submit@debbugs.gnu.org id=B61849.167939157511945 (code B ref 61849); Tue, 21 Mar 2023 09:40:01 +0000 Original-Received: (at 61849) by debbugs.gnu.org; 21 Mar 2023 09:39:35 +0000 Original-Received: from localhost ([127.0.0.1]:57685 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peYSt-00036b-0N for submit@debbugs.gnu.org; Tue, 21 Mar 2023 05:39:35 -0400 Original-Received: from heytings.org ([95.142.160.155]:48172) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peYSr-00036T-M7 for 61849@debbugs.gnu.org; Tue, 21 Mar 2023 05:39:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1679391572; bh=v61s7D6knQCTzGji+bhWmXvsuiawEJ8I2+JYoiNG8kM=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=FQ2TR4S18VJ9tI3at+Lfw/gDUn3zqws1LJT9T9fANOnIf/haBQx3Qt+tx+NW8WFPM M1M4GZr83/pMmal/OobqPVFsZa5SXXJ9nzFn6gM1KIN0gKodbbv6FyT8UUgbonw+1w Gu3Rw6rlpLhVNtj+NuJKDW6BPnGFNYwQaWnw4vSzTNppCRWul2WJjJWmQaN6qcnYm1 xwLsVVUDWIRVppG9RxvdCU0d0kjQKpXEnJBAFn5k83zt6k8lJLvAGc+zDP8POBv/Do +awQeSEzS2coqxpA/9ORqjaaFkWVf0xfDqhJ8n8KbFVhr6oedCiBBfF1gRTMhm8fst 8ctPjBvjnylcw== In-Reply-To: <83o7om7phl.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:258336 Archived-At: >> 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.