From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tim Cross Newsgroups: gmane.emacs.devel Subject: Re: Tree-sitter introduction documentation Date: Sat, 17 Dec 2022 11:03:50 +1100 Message-ID: <86cz8ivfvw.fsf@gmail.com> References: <83edszjslp.fsf@gnu.org> <83bko3jr3o.fsf@gnu.org> <83359fjoie.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26145"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.9.7; emacs 29.0.60 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 17 05:01:15 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 1p6ONv-0006bW-KY for ged-emacs-devel@m.gmane-mx.org; Sat, 17 Dec 2022 05:01:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p6ONC-0005lI-NX; Fri, 16 Dec 2022 23:00:30 -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 1p6ONA-0005kq-Pm for emacs-devel@gnu.org; Fri, 16 Dec 2022 23:00:28 -0500 Original-Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p6ON8-00007A-6b for emacs-devel@gnu.org; Fri, 16 Dec 2022 23:00:28 -0500 Original-Received: by mail-pf1-x42b.google.com with SMTP id 130so2996764pfu.8 for ; Fri, 16 Dec 2022 20:00:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:to:from:user-agent:references:from:to:cc:subject:date :message-id:reply-to; bh=1ZkLWxRlqCb149RH1Q21eBBwpRmJvWydJiaaIbvO6tQ=; b=djF+C5f7I6SwX8n98jAP6bfyBnxTMGR2SlPSkFRrtESKjcAX0mfI/k3/9scAMNkV3B SdlG72U0pIXLM/ExzfiHG5ULSr911tEIWOtoufm+qgch+G+ull64CNLUpKA5655oEiYr yhMLoNhZNRQB1ZN1jJivOZ52YpRvmxL4r8X/HDkMezyK2bUghxAooXH/FLeMy7e+x7A5 BvftB5sMWaZgJ9qtVZ5uM0ZoD8jX4tvZ4pP1F9bG6+q5PqOUMvFwlbsOlrboSsp47jpt SJABc7ORUWX5istwJjawPKxWpzjZ3B6a79oWOhpgNZ/df0Xb8UsYcQA4mQvoFeQeR8y9 ycSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:to:from:user-agent:references:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1ZkLWxRlqCb149RH1Q21eBBwpRmJvWydJiaaIbvO6tQ=; b=fEwydO0+K6hOzejJ/Bmt9cAYmjS53dRrS3SCOSvz906zRmV2+yX6AqYazADnKp4yXp lEktJCcwymiVXPo5MHIiW0e1A0xBSm64uSH1R8SfNdNgfVVOrQG9SYlx/24Ml+9RucI8 YwlBmQkfPJAFxLnZTYPkB1RNNzl/5JzJfS0fpeCyWh06ELv3zDZ5135qVV035y4ApbX5 nS1ozBJx8Ghu25W+PSpOSVYWKoWnwk1B1SzfVN0CxrqqCc3ypJcCo2wR39I1IJJkHlLJ 1N51nwTaRO0MRTOGWS+niKOSKhyDvTa42GOnKReWHuYQjLzhSOvA5685+M3zLG5yzQcj OmZw== X-Gm-Message-State: ANoB5pkXB5EMJ3r0mFxTUuz+9rpg+eTXpcHk9vSVth0p1/DtSty+a2w3 4VtgdtSComDXBc+22T29iNTTGJaKKCo= X-Google-Smtp-Source: AA0mqf7i20kAjyVCz+pCZ2G0cfBlMDR+cAsOTV39CdLzsNlkoBFlDbj7QCMWuxDDuzJDeyotGuaEvA== X-Received: by 2002:a62:1402:0:b0:577:d422:70bf with SMTP id 2-20020a621402000000b00577d42270bfmr38012817pfu.13.1671249624049; Fri, 16 Dec 2022 20:00:24 -0800 (PST) Original-Received: from dingbat (203-173-24-107.dyn.iinet.net.au. [203.173.24.107]) by smtp.gmail.com with ESMTPSA id t26-20020a62d15a000000b00576ee69c130sm2224450pfl.4.2022.12.16.20.00.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Dec 2022 20:00:23 -0800 (PST) In-reply-to: <83359fjoie.fsf@gnu.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=theophilusx@gmail.com; helo=mail-pf1-x42b.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:301540 Archived-At: Eli Zaretskii writes: >> From: Jo=C3=A3o T=C3=A1vora >> Date: Fri, 16 Dec 2022 15:48:03 +0000 >> Cc: pedz@easesoftware.com, emacs-devel@gnu.org >>=20 >> No, you don't need a NodeJS toolchain to compile a grammar. You only >> need to compile the C/C++ source files that are part of the grammar, >> and then link them into a shared library. I use a simple Makefile to >> build all of them, as the structure of the files and the way to >> compile and link them are identical and boilerplate. And I definitely >> don't have NodeJS installed here. >>=20 >> I used: >>=20 >> https://aur.archlinux.org/packages/tree-sitter-cpp-git >>=20 >> which builds with the makepkg tool, and am pretty sure >> it used NodeJS somewhere down the line. The language >> definition it seems to use is https://github.com/tree-sitter/tree-sitter= -cpp >> which also contains a log of JS stuff. > > It might contain JS stuff, but you only need to compile and link the > C/C++ files in the src subdirectory. You don't need to even look at > the rest. > >> Is that where you get your C++ grammar from? > > Yes. > >> If so where do you get your grammars from and can we=20 >> bundle some version of them with Emacs? > > No, we won't bundle grammar libraries with Emacs. It is not in the > scope of the Emacs project to provide external libraries; that's for > distros to arrange and for the individual users to install by > themselves. > > There are limits to what Emacs as a project can do about using > external libraries and tools. Given the installation of language grammars is reasonably straight forward (from what you posted earlier), what about adding a package to GNU ELPA which could facilitate/do the installation of a set of language grammars (similar to what the admin/notes/tree-sitter/build-modules/batch.sh script does. In addition to making it easier to install required dependencies and avoid the long tail that will likely exist for many distributions in implementing packages to install these grammars, it would also help ensure people install grammars with an acceptable license and avoid/reduce unwittingly installing non-free licensed code.