From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: Call for volunteers: add tree-sitter support to major modes Date: Tue, 18 Oct 2022 11:24:01 +0800 Message-ID: <87wn8xbyr2.fsf@yahoo.com> References: <83czb1jrm3.fsf@gnu.org> <878rlo7on0.fsf@thornhill.no> <83k04y1gd2.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="4675"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , casouri@gmail.com, theo@thornhill.no, emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 18 05:25:21 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 1okdEH-00013x-4u for ged-emacs-devel@m.gmane-mx.org; Tue, 18 Oct 2022 05:25:21 +0200 Original-Received: from localhost ([::1]:43758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okdEF-0005bE-Mk for ged-emacs-devel@m.gmane-mx.org; Mon, 17 Oct 2022 23:25:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37616) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okdDG-0004um-FQ for emacs-devel@gnu.org; Mon, 17 Oct 2022 23:24:18 -0400 Original-Received: from sonic317-33.consmr.mail.ne1.yahoo.com ([66.163.184.44]:37500) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1okdDE-0007iD-Tp for emacs-devel@gnu.org; Mon, 17 Oct 2022 23:24:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1666063453; bh=exQv8jWSJe9LRS0glGKhFhNcjvXgDDxAi/172F0aQ7M=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=cgI58SIw7Qnf7jXcmcnTU90XHw01KDyvjmtEFjmVIFRlY5xp3GrVZLOO6HCNw1oBvDog2HFVMP9nnj/doMLuv6gLZDngqdrTdYqL2TM7nRDU2kEKQ2dYRDkNFn2VA/sAyvOwJPhZ8EU9IcIjKQMnORtwLNrZrTGyeXKVTQYKzxSm6AZsQkgBPhYFUf0wj6dbs5e63dfwqFqfqG/Oe2ybzeqLMo+oAqURzJAMLxuW3H0jindVuzy3ClmkifB9SxSwgAWI5H2cAa3pC60qMV1MY7C+1XzvjLXLfqnLP4OMx5Bd7vK5QJZTdij22VbcnzQqMx2UaKck4HY64oU2M415/A== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1666063453; bh=SmFZH5jujW9vV2sW+9fsF6wkFdHKuBaD7cRsai4Bi0q=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=jOlkfvtD1BX3+kE33b/MhvbRgyS899hy/Wc23v56EtIKR9oHqG3LyXEP1qtP+JhkL/K8WKzR+8/RHkTKYwnekqmCJqzhP30DbHDnzAkf0OOREuuLcZuP5KiOvt1Y+HaSTuAl/jLf82BAxfz5E6GLQiQI1X3C7mCXwU48s2BSZsKBXNrXLaW/0/R4xR/CD2X+C+GiKdxTUEN0PbdgIRMLH1fe7frVml9d3QWFtI2Ye0LBWtTtJdAtamDigZLtMRXW06feeiYne7cNEpa3h0wNzX9DQJLM9RXuTNj32i7kmb3tT69ApnKFDvfSxoS6R1dQ+fjQjWDCN8i1/AmilNQ5Lw== X-YMail-OSG: 8xwQXaUVM1lg2hZwOqhy4_c8oWgqsue6x67mqKnZ9pwzBDr2tgMt4.yU8cq1YXo Av8vSYaiT0fUeksK7ZwcdfXzVKn2XSBCo9SEG9d00ecj_RmBhjx3w8nIfjD5UpX.rQ4UFlSaApFr obpz0dlRIMDg3C0L4nohl6HzFrgo._RmxncdJDuWesdp7Bb60VspnFXoTkqkUibjJW8EM0Ly2IID iJYJXARFwNPfp6fyCknUqn0IxFcj82oV_H57PTIU8W8h1XWV5UJX5xXTH5xlcD0Zb.fSpeALvUky shmwgBl5pkhflHhj9zwlO94EOSof2WaZmX5ASvf8PpcFnN_cXRBiwlGxkifVUmntstFuaQVCGddL rGevmGzMLw26keqGLa_QT8J1oPqzdwQdM_nslmFGymCg6W45JA78lfiFpyRA_vtk0uO4aCzbskg9 hRZ0WcbJ4ffYyRvt74WUp3onxFrBz4gmxTSfJYMC.jVGwwWvQUyuYoNKizWkbGG9URARjl6bLmvC JpBmCMIuYsjgGngfjShkoAx.QQd.LKmxqsNq7lpTo1_bW1r1.LJ1gfNJ1JsMrcO.tzClDi9ZtkEL SrCFQ173w.Wq.4zyC8mwz_DzDj.KaKHmUmFdAnZwWHpyik1xCsr4kp5fTptY_A9tiCxHPoBT8Ewp YIGpapU0k5sW9msrvFdsczcyuxFBelJPduEfdnxu.f.kNQBHG..0gkoZFmlF0H_G8adlgxuIhwHH cAJzxgM1TW2R8YNsMeqS11LVXSo9t9EFxnI4T.xsk1Gzfnc.p85Un7GPY4SrhMe6D2IEALhjd5tZ wvex8ED5xs.AVq111BmhgcMpRHDFKiy_M6D1vMa1E0 X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic317.consmr.mail.ne1.yahoo.com with HTTP; Tue, 18 Oct 2022 03:24:13 +0000 Original-Received: by hermes--production-sg3-785466d859-4mnw4 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 521d6d1cc5b44747422729b5bcef5ed8; Tue, 18 Oct 2022 03:24:06 +0000 (UTC) In-Reply-To: (Alan Mackenzie's message of "Mon, 17 Oct 2022 18:47:34 +0000") X-Mailer: WebService/1.1.20740 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.184.44; envelope-from=luangruo@yahoo.com; helo=sonic317-33.consmr.mail.ne1.yahoo.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, RCVD_IN_MSPIKE_H2=-0.001, 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.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:298006 Archived-At: Alan Mackenzie writes: > Generally, that the replacement of CC Mode's engine with tree-sitter is > a good idea; CC Mode as it currently is is too much work to maintain, > and in the long run is unsustainable. > > At the same time, I have no idea how good tree-sitter's grammars for CC > Mode's modes are. If I understand rightly, a call to TS requires start > and end buffer positions to be calculated by Emacs rather than TS > itself. This might reduce some of the expected speed gain. > > I would like to keep all of CC Mode's user features in the new mode, if > at all possible. I don't know how easy it will be, for example, to keep > CC Mode's indentation styles working in the new mode. > > I can't honestly see myself as able to integrate tree-sitter into CC > Mode in the short time before the planned pre-test of Emacs 29. I think > we should take up the offer made by Jo=C3=A3o Paulo Labegalini de Carvalho > on 2020-10-11 to work on C Mode and possibly C++ > Mode. > > I'm afraid I've only read a small part of this thread on emacs-devel, so > there's likely quite a bit of relevant stuff I've missed. Could someone please tell me how well tree-sitter supports pre-standard C with liberal (and sometimes non-standard) use of the C language? I'm talking about code that looks like this: MACRO_USED_TO_DEFINE_SPECIAL_FUNCTIONS (function_name, cells, transform) some_kind_of_ptr cells; another_kind_of_ptr *transform; { extern maybe_tls (int) errno; extern caddr_t bar (_P (another_kind_of_ptr, ...)); int rc; BEGIN_A_KIND_OF_SECTION ({ ENTRY (dx, dy, shx, shy) float dx, dy, shx, shy; if (!bar (other_function (dx, dy, shx, shy), etc, etc, etc)) die ("bar", sys_errlist[errno]); }, register float, section_name); rc =3D more_code_here (§ion_name_desc, etc); return rc; } I don't doubt that tree-sitter is good at parsing newer languages like Typescript, but does it support C all that well?