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 api Date: Sat, 11 Sep 2021 12:00:59 -0700 Message-ID: <73E0B1F6-6F9F-40E0-927E-D08481BFF391@gmail.com> References: <83r1f7hydn.fsf@gnu.org> <95F37923-5BF9-4D81-B361-267CF119FBCA@gmail.com> <735AF34C-FD18-4A6A-A99D-E5D8EB4DE4F3@gmail.com> <40611F1F-7B5C-4885-A2CA-CE709ED8D22B@gmail.com> <4E876354-10D1-46B3-8124-CAE916261F08@gmail.com> <0A3F5464-B90D-4D47-BBDD-CCA26D877F43@gmail.com> <83tuiys1y4.fsf@gnu.org> <835yvcpdip.fsf@gnu.org> <7B1F90DE-A992-4F51-B391-0A4E5A598780@gmail.com> <3E8CA8E4-E623-4051-A76D-508C6CF94B6A@gmail.com> <837dfpj5yf.fsf@gnu.org> <8335qbirsr.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) 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="6057"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?utf-8?B?VHXhuqVuLUFuaCBOZ3V54buFbg==?= , theo@thornhill.no, cpitclaudel@gmail.com, emacs-devel@gnu.org, monnier@iro.umontreal.ca, stephen_leake@stephe-leake.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Sep 11 21:02:43 2021 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 1mP8Gx-0001OF-En for ged-emacs-devel@m.gmane-mx.org; Sat, 11 Sep 2021 21:02:43 +0200 Original-Received: from localhost ([::1]:50552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mP8Gv-0007ik-5G for ged-emacs-devel@m.gmane-mx.org; Sat, 11 Sep 2021 15:02:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48922) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mP8FN-0006v9-7o for emacs-devel@gnu.org; Sat, 11 Sep 2021 15:01:05 -0400 Original-Received: from mail-qk1-x734.google.com ([2607:f8b0:4864:20::734]:33465) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mP8FL-0002f7-Hz; Sat, 11 Sep 2021 15:01:04 -0400 Original-Received: by mail-qk1-x734.google.com with SMTP id b64so6024789qkg.0; Sat, 11 Sep 2021 12:01:02 -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=d3N4ACtf/7XHomAG9Nb9V8J/hSDxMij5HiCoa4JEKmw=; b=hb4OGiU8aGM0pmWN3mobdhisiGsNvyYxKpjt5Rzzagh7ZPlEZ5LRcg17ljJ00y3cXp G/aDbIXyJqGT3jrBfHqXKq7TxdRLvP71hLGSzfOQpFqXQVH0jDYrbb0we3/My8FE9nhI Mv3886v5yOR/SFWbdyRDkAaIH1mhhnvEFfgQAmyijbYxX9cRESvMaUG2/lUL+1xnk+WR CvC+YgCSmfDYvfIkQmOyXRQ1joR4FUSohoXuu2kQqIfHLD7s4weDArZ4Jxqfdn3Kylwt YQ8ArK9mXZQtHzb0MFbv47JKJ7qBlS/4OejOT8nD/HQGuDxPwS4jugTrzs9O1+O90Xkv pM9g== 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=d3N4ACtf/7XHomAG9Nb9V8J/hSDxMij5HiCoa4JEKmw=; b=J+kxEMCjfXqAgK8TnUoKDLr1yZfH6XM7iKGmt1RFPw4HthPGKG/mY7MimQcFJGQQCy pS2ZUPei3jlDhgLOzqwO9z98PPh0y113MuCMWoK9HXxSo/KUzF4HSEd7boP1toY6J4U/ kvYUYaCz8e2xJ2THxiSyP78TfSC1cmfhdiTqOnUrdjRDXf4ZzsiJDbdH/Hrh7GhCYgzh cSfsFePwfr7gSiXvXOGrFuHfqJiK9Swtaz8z4s//DEh3K8xGSr8qRs/vRZeKDx7ZRXM4 X+FFY83vEoFzSbCoPP9k/0UfAKk0Q5f23EoCUcuZnI6A8zRqHvFRg3DwhWIai2JlrBzL k2Nw== X-Gm-Message-State: AOAM533BxSvA7pYuu8JA7l0uFL7N7foGQT9zoKotTScj+QHNzM11Q6jK 70fR8zOT/4ggj1Xs8GC9q4fbh+KeR/Bl5AiU X-Google-Smtp-Source: ABdhPJxG3C4ceyd+aapR/pxqSj717DAIVSS4sJxP1M2wT7Oh9yxvPAl2lh2BxAnmCSnKUrlxYkdiGw== X-Received: by 2002:a37:6849:: with SMTP id d70mr3121270qkc.267.1631386861707; Sat, 11 Sep 2021 12:01:01 -0700 (PDT) Original-Received: from smtpclient.apple ([2600:1700:2ec7:8c9f:a158:bbab:fca1:1f4e]) by smtp.gmail.com with ESMTPSA id b15sm1677125qka.107.2021.09.11.12.01.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 Sep 2021 12:01:01 -0700 (PDT) In-Reply-To: <8335qbirsr.fsf@gnu.org> X-Mailer: Apple Mail (2.3654.120.0.1.13) Received-SPF: pass client-ip=2607:f8b0:4864:20::734; envelope-from=casouri@gmail.com; helo=mail-qk1-x734.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 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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:274561 Archived-At: > On Sep 10, 2021, at 10:51 PM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Fri, 10 Sep 2021 12:57:22 -0700 >> Cc: Tu=E1=BA=A5n-Anh Nguy=E1=BB=85n , >> Theodor Thornhill , >> Stephen Leake , >> Cl=C3=A9ment Pit-Claudel , >> Stefan Monnier , >> emacs-devel@gnu.org >>=20 >>> Sure. I guess we will have to have a database of module names for >>> each programming language somewhere? >>=20 >> My plan is to translate lisp names to C names by default, and have an = override list for irregular names that can=E2=80=99t be translated = correctly. >=20 > What are "Lisp names" in this context? Are you saying that the name > of a programming language, derived from the major mode, can be used to > produce the name of the shared library programmatically? If so, how? I don=E2=80=99t think it=E2=80=99s a rule, but language definitions are = conventionally named tree-sitter-. E.g. tree-sitter-c, = tree-sitter-json, tree-sitter-c-sharp. And the symbol they expose are = tree_sitter_, e.g., tree_sitter_c, tree_sitter_jon, = tree_sitter_c_sharp. Currently we use a symbol tree-sitter- to = represent a language, so we can translate the symbol tree-sitter- = to tree-sitter-.so/dylib/dll to get the shared library name, and = to tree_sitter_ to get the C symbol name. BTW, since dynamic libraries has different extensions on different = systems, what I want to do it to try loading the library with .so, then = try .dylib, then try .dll, is that a good idea? >=20 >> Just realized another problem, how do we make sure the loaded library = is GPL-compatible? There certainly won=E2=80=99t be = =E2=80=9Cplugin_is_GPL_compatible=E2=80=9D symbol in them=E2=80=A6 And = IIUC Emacs cannot load GPL-incompatible dynamic libraries? >=20 > That's only needed for Emacs modules, not for external libraries that > provide some extra functionality on the level of primitives. For > those, we just make sure their license is compatible with GPL. Thanks, that=E2=80=99s all I need to know. Yuan=