From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Perry E. Metzger" Newsgroups: gmane.emacs.devel Subject: Re: [SPAM UNSURE] Maybe we're taking a wrong approach towards tree-sitter Date: Mon, 2 Aug 2021 18:13:17 -0400 Message-ID: <55094f8b-3572-0193-2280-b8e80500082f@piermont.com> References: <8735rzyzbz.fsf@163.com> <86v94v3xh9.fsf@stephe-leake.org> <87wnpargnb.fsf@elite.giraud> <87h7gey7zx.fsf@163.com> <83pmv2twrl.fsf@gnu.org> <86sfzwogsn.fsf@stephe-leake.org> <87o8akmy4p.fsf@163.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24045"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.0 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Aug 03 00:15:04 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 1mAgDA-00064Z-G6 for ged-emacs-devel@m.gmane-mx.org; Tue, 03 Aug 2021 00:15:04 +0200 Original-Received: from localhost ([::1]:54116 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mAgD8-0004Wx-Hb for ged-emacs-devel@m.gmane-mx.org; Mon, 02 Aug 2021 18:15:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49962) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mAgBc-0003pO-EL for emacs-devel@gnu.org; Mon, 02 Aug 2021 18:13:28 -0400 Original-Received: from hacklheber.piermont.com ([166.84.7.14]:34884) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mAgBZ-0005xP-LY for emacs-devel@gnu.org; Mon, 02 Aug 2021 18:13:28 -0400 Original-Received: from snark.cb.piermont.com (localhost [127.0.0.1]) by hacklheber.piermont.com (Postfix) with UTF8SMTP id 213CA19E for ; Mon, 2 Aug 2021 18:13:18 -0400 (EDT) Original-Received: from [10.160.2.107] (jabberwock.cb.piermont.com [10.160.2.107]) by snark.cb.piermont.com (Postfix) with UTF8SMTP id D3DEF2DE9A7 for ; Mon, 2 Aug 2021 18:13:17 -0400 (EDT) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=166.84.7.14; envelope-from=perry@piermont.com; helo=hacklheber.piermont.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-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.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:271945 Archived-At: On 7/30/21 08:06, Arthur Miller wrote: > I undestand that having specialized regex matcher is more efficient than > some generalized regular matcher current font-locking in Emacs relies > upon, but is it *that* more efficient to be worth the extra troubles? It is not a question of efficiency. You cannot parse a context free grammar using regular expressions. The reason that almost all our highlight modes produce random garbage throughout is that you cannot parse a context free grammar using regular expressions. (For many languages, correctness isn't just occasionally violated, it's generally violated.) Reliable highlighting regardless of code formatting, reliable indentation assistance, reliable code folding, and other such features require that the editor be able to both parse the program being edited _and_ that the editor be able to incrementally re-parse it as it changes in minimal time. Other editors now have such features and make good use of them. Highly reliable code folding alone is worth the price of admission IMHO. (Currently, the best we can do for code folding is assume that the indentation is correct.) LSP has been revolutionary in improving the programmer's experience in Emacs. Tree Sitter will provide significant additional improvement. > TS seem to keep state (a node) for each character typed, that will be a > lot of memory consumed in some big files. No one will be forced to turn it on. I, however, almost certainly will. My productivity is more important to me than my RAM budget. Those that don't like it, though, won't have to pay the RAM tax. Perry