From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christian Johansson Newsgroups: gmane.emacs.devel Subject: Re: New package emacs-parser-generator Date: Wed, 1 Dec 2021 09:51:26 +0100 Message-ID: References: <7C564949-3B67-459F-B149-AE17CC371781@gmail.com> Mime-Version: 1.0 (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="594"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , =?utf-8?Q?Daniel_Mart=C3=ADn?= , Stefan Monnier , Emacs developers To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Dec 01 09:52:50 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 1msLM9-000AXp-Ra for ged-emacs-devel@m.gmane-mx.org; Wed, 01 Dec 2021 09:52:49 +0100 Original-Received: from localhost ([::1]:58876 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1msLM7-0004JF-M5 for ged-emacs-devel@m.gmane-mx.org; Wed, 01 Dec 2021 03:52:47 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:52644) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1msLKw-0003c7-Nk for emacs-devel@gnu.org; Wed, 01 Dec 2021 03:51:34 -0500 Original-Received: from mailrelay3-3.pub.mailoutpod1-cph3.one.com ([46.30.212.12]:34823) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1msLKu-0004F3-NV for emacs-devel@gnu.org; Wed, 01 Dec 2021 03:51:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cvj.se; s=rsa1; h=to:references:message-id:date:cc:in-reply-to:from:subject:mime-version: content-transfer-encoding:content-type:from; bh=G2BLnFVfo+QW/NndGEDRabodjDwivj/FBho5nYqLUrE=; b=OQv5KyfMUkV30WP08b/j7TeymQLAkOSQGUSIG8KUbsFldU3PBgklnuik7IDtokM67RQZSdwKp0UD4 Tv+TkVsFY1pERyhp+EfsO8j6frZUHSWLja/5V/fu/yZwqm8e7zZyt4qIiGFYIrHkHWsGp2iwJp62p3 EsYHwzQOnY4fCPl6HQ2+dFczFIEBPFF8xd36T8AwMyghnhUMFIquyPQmv3evCoMZFLZsB6QrId7qo4 S08CB2WKOXfZGMregk5FBp/CB+LfAhu6g/gFK4xuXeVbYmMO6sWLMJgB0tRQ3v7Mja5ZNPjrEUSG+E KNvzcn7vPUAzJlPp7ErgEspSgAkzUSA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=cvj.se; s=ed1; h=to:references:message-id:date:cc:in-reply-to:from:subject:mime-version: content-transfer-encoding:content-type:from; bh=G2BLnFVfo+QW/NndGEDRabodjDwivj/FBho5nYqLUrE=; b=R+TsnioVfe9/9u2U7dKSoekQsiB/d7ka8RxRjW/4uU3BRgOnaSkkJy+G8PG6Xxwit+a2URnXYSPSD 32TgNSfBA== X-HalOne-Cookie: f4099909b9b1d478e6f5f978c85f01e4bcbff6e7 X-HalOne-ID: deb6cb1e-5283-11ec-87a6-d0431ea8bb03 Original-Received: from smtpclient.apple (c188-150-212-230.bredband.tele2.se [188.150.212.230]) by mailrelay3.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id deb6cb1e-5283-11ec-87a6-d0431ea8bb03; Wed, 01 Dec 2021 08:51:27 +0000 (UTC) In-Reply-To: <7C564949-3B67-459F-B149-AE17CC371781@gmail.com> X-Mailer: iPhone Mail (19A404) Received-SPF: none client-ip=46.30.212.12; envelope-from=christian@cvj.se; helo=mailrelay3-3.pub.mailoutpod1-cph3.one.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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_NONE=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:280598 Archived-At: > 1 dec. 2021 kl. 09:39 skrev Yuan Fu : > =EF=BB=BF >=20 >> On Nov 30, 2021, at 11:52 PM, Christian Johansson wrot= e: >>=20 >> Alright, could you give some more details about when a buffer parse is tr= iggered, is it via threads, is it sometimes incremental, does it work on a s= tring copy of the buffer or on the buffer contents directly? >=20 > Tree-sitter parses incrementally, I modified primitive insert/delete funct= ions in insdel.c to incrementally parse changed content. There is no need fo= r threads as incremental parsing is extremely fast. We don=E2=80=99t make co= pies of buffer string, instead, we pass tree-sitter library a function that r= eads directly from the buffer. Ok where can I read about this function? How does treesitter handle incremen= tal parses which are state-dependent? For example PHPs lex-analyzer works di= fferently in different states of the grammar, like do you signal to treesitt= er a point in the buffer so it can backtrack the parsers states in order to c= orrectly perform a incremental parse on the new content? >=20 >>=20 >> Does treesitter expose a (faster) regexp matcher that perhaps can be used= by my library? >=20 > Not that I know of.=20 >=20 > IIUC, tree-sitter integration doesn=E2=80=99t have much to do with propose= d emacs-parser-generator, it just exposes tree-sitter to Emacs, and adds som= e integration to font-lock and indentation that leverages tree-sitter featur= es; whereas emacs-parser-generator seems to be about defining grammar and ge= nerating elisp parsers. Yes I understand, I'm just curious to see if I could perhaps take use of any= of the new features treesitter introduce =20 Regards Christian=