From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: Re: [SPAM UNSURE] Re: [SPAM UNSURE] Maybe we're taking a wrong approach towards tree-sitter Date: Thu, 29 Jul 2021 16:25:40 -0700 Message-ID: <86o8akog7f.fsf@stephe-leake.org> References: <8735rzyzbz.fsf@163.com> <86v94v3xh9.fsf@stephe-leake.org> <87o8amy88o.fsf@163.com> <20210728123612.pr2ddrf6vmynknxn@Ergus> <877dhawpr7.fsf@163.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3599"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (windows-nt) Cc: Ergus , emacs-devel@gnu.org To: Andrei Kuznetsov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jul 30 01:26:42 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 1m9FQH-0000k6-QH for ged-emacs-devel@m.gmane-mx.org; Fri, 30 Jul 2021 01:26:42 +0200 Original-Received: from localhost ([::1]:42388 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m9FQF-0002Si-V0 for ged-emacs-devel@m.gmane-mx.org; Thu, 29 Jul 2021 19:26:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m9FPY-0001nC-Mq for emacs-devel@gnu.org; Thu, 29 Jul 2021 19:25:56 -0400 Original-Received: from gateway20.websitewelcome.com ([192.185.53.25]:34967) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m9FPV-00051T-VJ for emacs-devel@gnu.org; Thu, 29 Jul 2021 19:25:56 -0400 Original-Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway20.websitewelcome.com (Postfix) with ESMTP id 674D1400D4305 for ; Thu, 29 Jul 2021 18:09:38 -0500 (CDT) Original-Received: from host2007.hostmonster.com ([67.20.76.71]) by cmsmtp with SMTP id 9FPNmiJxhBvjy9FPOmutjc; Thu, 29 Jul 2021 18:25:46 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=stephe-leake.org; s=default; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=MjlvHvX9EWMMXGu7MvCwbA5PmXi4f6qDRff4A9Rwt+U=; b=ZKOYymxkRbLjGcKxkByoDsnU7p PaZ18TxsD8bw3AFL+TwPMa/YrQSfxtBzX/UJxv11ZUc7QUqEdZYoBAH2VF1fnowgvn7ljInQotFUg 9KXXy/YzMRDSanTYAGa4m4trDv+aN/4ZD37aczeP9DGiPswVsxai8rpQ2SMc5bAOLKKV7DNz8jNfK n4QBAw3bMWcbEgMekG4XjTVXo2GNmrbaTnBr8vS4X3KYpbES0SEIjmQ1fc5E7SHGax+/CZtw1xCdD Ymu2Yhm8zq+qWLKjG9IgaWjRQ5tXImlX3hj6D+mPgHzM573ZPazlz4OWJXXYDABfEpLVXx3a6RuFe lM0+EoBA==; Original-Received: from [76.77.182.20] (port=50633 helo=Takver4) by host2007.hostmonster.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1m9FPN-000BYD-Kh; Thu, 29 Jul 2021 17:25:45 -0600 In-Reply-To: <877dhawpr7.fsf@163.com> (Andrei Kuznetsov's message of "Wed, 28 Jul 2021 21:07:40 +0800") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host2007.hostmonster.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stephe-leake.org X-BWhitelist: no X-Source-IP: 76.77.182.20 X-Source-L: No X-Exim-ID: 1m9FPN-000BYD-Kh X-Source-Sender: (Takver4) [76.77.182.20]:50633 X-Source-Auth: stephen_leake@stephe-leake.org X-Email-Count: 17 X-Source-Cap: c3RlcGhlbGU7c3RlcGhlbGU7aG9zdDIwMDcuaG9zdG1vbnN0ZXIuY29t X-Local-Domain: yes Received-SPF: permerror client-ip=192.185.53.25; envelope-from=stephen_leake@stephe-leake.org; helo=gateway20.websitewelcome.com X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_NEUTRAL=0.779 autolearn=no 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:271808 Archived-At: Andrei Kuznetsov writes: > Ergus writes: > >> 1) Performance (discussed in the previous thread): > > FWIW I have been experimenting with an increcemental GLR parser > generator in Emacs Lisp. The "generator" and the "runtime" are two separate programs, with separate functions, used at different times. The generator takes the javascript language grammar file and translates it (thru lots of hairy computations) into code that builds a parse table and other data structures. The tree-sitter generator outputs that code in C; it might be possible to adapt it to output in elisp (the wisitoken generator used to output elisp, but i gave that up when I implemented error recover in Ada; elisp is way to slow for that). The "runtime" uses the parse table to parse text at runtime, in response to user actions on the buffer. To be useful in an interactive editing context, it must have robust error recovery. What is your error recovery algorithm? > While I have not put in the effort to couple it with font-lock and > such, from anecdotal examination it does not perform badly with a > naive C grammar. Are you talking about the generator or runtime here? > The initial parse does take several seconds on large files, That's the runtime. Actual time for xdisp.c, preferably compared with a tree-sitter parse run on the same machine, would be helpful. How long does the generator take? > but afterwards I did not notice a significant drop in editor > responsiveness. This seems to imply that the runtime supports incremental parse, so it does not reparse the whole buffer each time; is that true? >> 2) Not reinvent the wheel. > > While tree-sitter may be nice and all, it doesn't seem to offer the > usual extensibility expected from Emacs. It's all open-source, but it is very complicated and may be beyond many people's ability to change correctly. It requires running a C compiler to change it, but so do other parts of Emacs (for example, the json parser). So what is it missing? -- -- Stephe