From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: Tree-sitter integration on feature/tree-sitter Date: Sun, 8 May 2022 14:14:11 -0700 Message-ID: References: <5bada349-2f43-4325-b696-70918584cd3d@email.android.com> <83mtfsuluo.fsf@gnu.org> <87sfpjhm33.fsf@thornhill.no> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.80.82.1.1\)) 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="24145"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , Stefan Monnier , emacs-devel@gnu.org To: Theodor Thornhill Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun May 08 23:15:08 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 1nnoFA-00063M-1D for ged-emacs-devel@m.gmane-mx.org; Sun, 08 May 2022 23:15:08 +0200 Original-Received: from localhost ([::1]:41696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnoF8-0005RG-TM for ged-emacs-devel@m.gmane-mx.org; Sun, 08 May 2022 17:15:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36604) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnoEK-0004fw-O7 for emacs-devel@gnu.org; Sun, 08 May 2022 17:14:16 -0400 Original-Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:45698) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnoEJ-000186-6L; Sun, 08 May 2022 17:14:16 -0400 Original-Received: by mail-pg1-x529.google.com with SMTP id 7so10437146pga.12; Sun, 08 May 2022 14:14:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=VKJa6FkCDJ4wyZlyTRJ+x+PCz0WGuQgn5eurSEJQaRA=; b=oTmUsd67kwDImmvNpUh+wUl7TXnpj+ahgxtnW+uc8+wLbMGwUK4JL+1V8GOwSdElv1 K3uIrqYXy4Oa9nmYBGK6la/39JeKrGkFgsKldbteF0KbOvqbPE/92I+xDTQ2MTEwsOZr PK1wkXujdXh2JEbzJwz/2gGv3y9ArJwc5nchmUYAumObAm2nWBjM3podHddgiEVhUSuq 6ogWu0nReQF1vrsBmsHuP22diScojnHUvnN5GHwBzqhXgf8ZqmoR2gURvOA2jOfC9FjH YKXsyHMYZiGRhil2MlSHdqsZFprGfzNRTWWeyQlmFwPvdd6qNjGUBKYSB3UUVdkFXDwk XjEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=VKJa6FkCDJ4wyZlyTRJ+x+PCz0WGuQgn5eurSEJQaRA=; b=CX97PpPQ0WRRjQX6pmi/cjK/ZWplIF1PE3t9i9dsOiKWcBEXQj7/wyDjBtF0ph46iS R3Ue7w3Ub/uhRMyaJp6Re5Ik5XlTYNrZrtkD/y//LURvE3v1ulY/HE9QpnpW8il0DTwR 4P2Mv2ovEYUyq2yZhYuQg0LkTzJS4RboxLQ7CngI0sC3w9mJAEKI/o+d6qjwKYys4HXh vZ1KJPCFd6yR11PogHZVHsPVAVfLhiFjSfFrWf6lkchbF2dYv4453TUrzK75te1HELIM jgtQ5G1Os/eCyC307uyseCCdZJr6cgSsCPMtBJWYkka/kcNgNlUQJBfUmPaQKR4aMuAD plfg== X-Gm-Message-State: AOAM530/DZUUUtJpAxSJl4Wpe5RD+1B/wQPwTT82Ay2L6IDDl9BcMFRQ x6GVHd1OY3nYPPUtYOlLxUY= X-Google-Smtp-Source: ABdhPJyv+mAf6C0P5t6vwQ0w4ILv64dmgaP4Bfc4INs3ooJoTVWgD1nbpGc1hLlvBzW6rPETLEzn5w== X-Received: by 2002:a63:fa4d:0:b0:3ab:7a48:b2b7 with SMTP id g13-20020a63fa4d000000b003ab7a48b2b7mr10650616pgk.519.1652044453103; Sun, 08 May 2022 14:14:13 -0700 (PDT) Original-Received: from smtpclient.apple ([2600:1700:2ec7:8c90:45d2:2f3d:5494:d9ad]) by smtp.gmail.com with ESMTPSA id f5-20020a170902ce8500b0015ef27092aasm4458329plg.190.2022.05.08.14.14.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 May 2022 14:14:12 -0700 (PDT) In-Reply-To: <87sfpjhm33.fsf@thornhill.no> X-Mailer: Apple Mail (2.3696.80.82.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=casouri@gmail.com; helo=mail-pg1-x529.google.com 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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" Xref: news.gmane.io gmane.emacs.devel:289498 Archived-At: > On May 8, 2022, at 12:16 PM, Theodor Thornhill = wrote: >=20 >>=20 >> My understanding was that tree-sitter can load these *.js parsers as >> they are downloaded from the respective sites, or that there are = tools >> available to compile them if needed. Why cannot we leave it to users >> to do that by themselves, instead of using an Emacs module? >=20 > Oh right, now I understand. The tree sitter implementation doesn't = use > an Emacs module any longer. It uses the language definitions = libraries > like any other editor. If you use the tree-sitter-module script you > should use the 'batch-new.sh' script. This only creates a .so file. = My > guess is that you could use any guide on the internet to compile such = a > shared object, then use it in emacs. It seems to be a bit picky on = the > naming; it needs to be called 'libtree-sitter-LANG.so', which should > probably be documented somewhere. I cannot see that it is, yet. libtree-sitter-LANG.so/dylib/dll seems to be the convention for language = definition libraries. If there are irregular ones, one can use = treesit-load-name-override-list to accommodate that (which is documented = in the manual). >=20 > So in short: Emacs cannot load the .js directly, but when downloaded > they should be compiled to a .so/.dll/.dylib and put somewhere emacs = can > see it, such as ~/.emacs.d/tree-sitter. This could be left to the = user, > but it would be nice for emacs to do this, or at least a package in > elpa/nongnu elpa that does this so that the barrier of entry isn't too > high. I don=E2=80=99t think anyone uses the .js grammar files directly, all = the editors that support tree-sitter uses the compiled .so files, and = .so files are what each language definition distributes. Also the = compiler that compiles the .js grammar is written in IIRC nodejs, which = I don=E2=80=99t want to come close to whenever possible. Yuan=