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.devel Subject: Re: Tree-sitter introduction documentation Date: Wed, 28 Dec 2022 12:56:09 +0000 Message-ID: References: <83edszjslp.fsf@gnu.org> <87tu1vxs3a.fsf@ledu-giraud.fr> <831qozjob7.fsf@gnu.org> <87cz8jxoat.fsf@ledu-giraud.fr> <83wn6ri7pn.fsf@gnu.org> <5e0a3185-de82-b339-0fa2-956779e63d6f@cornell.edu> <868rj6vfep.fsf@gmail.com> <4895891b-e5ea-9c37-f51b-df2e479ee758@yandex.ru> <83y1qt11xq.fsf@gnu.org> <9eb013da-d0fc-8e17-c6e3-1e8f913aebfa@yandex.ru> <83pmc50xxc.fsf@gnu.org> <71cfe4e8-3bb8-b0a6-9be5-8c0a6d92cfab@yandex.ru> <83h6xg29z3.fsf@gnu.org> <838ris22n4.fsf@gnu.org> <8335901zz3.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="6404"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , dgutov@yandex.ru, theophilusx@gmail.com, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Dec 28 13:57:39 2022 Return-path: Envelope-to: ged-emacs-devel@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 1pAW02-0001Sg-OI for ged-emacs-devel@m.gmane-mx.org; Wed, 28 Dec 2022 13:57:38 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pAVyy-0006vj-EG; Wed, 28 Dec 2022 07:56:32 -0500 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 1pAVyw-0006rk-6J for emacs-devel@gnu.org; Wed, 28 Dec 2022 07:56:30 -0500 Original-Received: from heytings.org ([95.142.160.155]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pAVyu-0007y2-CH; Wed, 28 Dec 2022 07:56:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1672232170; bh=b0iIZUvgVLQJK7+cBDfkg0Ddl+i+MKwtzoRoqI9BFtE=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=SqGym5d1PAX1HCh+2Vs4G9gYMp6YZWfvXcxRJgqckpXeq/dStYqe7nGTxcw82HeMi Teelk2uj6WbwD/VPFpZQ+drFbhPHlBFIWbQx3OORqvnDbIL7JLxZpJLEpGR7wvUhVM WNVp3lZlsvjWES5AETbOj75A/exOKbQbR1PTz5uYCBcrACVFpELn5Ckn3z5hPf8RjC ix6Q6DGqxIViUApe3PnhUOSwoo07GCuQCmKFQn4QwtWIqjZB9nfCaj4aJ4eX1s+Ayu v1vaMAZvDxqrCpxH3fsN6WtPy+08ed4v03AJ4+bqYaFPSJGgQZOe3WarFU1LVZ0xMA 0CodXqRC4IWdg== In-Reply-To: Received-SPF: pass client-ip=95.142.160.155; envelope-from=gregory@heytings.org; helo=heytings.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:302000 Archived-At: >> Good luck with that! It requires to install Node.js and other stiff, >> which I personally won't touch with a 3-mile pole, and I'm unsure (but >> never bothered to find out) whether free replacements even exist. > > That's the part of Tree-sitter which makes me a bit uneasy. > > In Emacs, we usually don't just stick to the letter of the Free Software > principles (e.g. release our code under the GPL) but we try to go the > extra miles so that our users can actually exercise their rights as > easily as possible (e.g. with things like `C-h k` that lets them jump > straight to the source, ...). > > But with Tree-sitter, our users are currently a bit stuck. The grammars > are Free, yes, but it takes a fair bit of extra work (and potentially > even some code with unclear licensing along the way) if you want to > modify their source code and use the result :-( > I think that's an exaggeration. On a Debian-based system, building a grammar from source is as easy as typing three commands: $ apt install gcc nodejs rust-all $ cargo install tree-sitter-cli $ tree-sitter generate grammar.js Step 1 installs the necessary tools, all of which are free software (GPL for GCC, MIT for Node.js, dual MIT and Apache for Rust). Step 2 downloads the source code of tree-sitter and of all its dependencies, and builds tree-sitter. Again it is, and its dependencies are, free software (MIT for tree-sitter, and for its dependencies usually dual MIT and Apache like Rust itself, sometimes BSD or Zlib or public domain). Step 3 converts the grammar.js file into the parser.c file. Now you can use GCC to build the library.