emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New package emacs-parser-generator


From: Christian Johansson
Subject: Re: New package emacs-parser-generator
Date: Wed, 1 Dec 2021 09:51:26 +0100


> 1 dec. 2021 kl. 09:39 skrev Yuan Fu <casouri@gmail.com>:
> 
> 
>> On Nov 30, 2021, at 11:52 PM, Christian Johansson <christian@cvj.se> wrote:
>> 
>> Alright, could you give some more details about when a buffer parse is 
>> triggered, is it via threads, is it sometimes incremental, does it work on a 
>> string copy of the buffer or on the buffer contents directly?
> 
> Tree-sitter parses incrementally, I modified primitive insert/delete 
> functions in insdel.c to incrementally parse changed content. There is no 
> need for threads as incremental parsing is extremely fast. We don’t make 
> copies of buffer string, instead, we pass tree-sitter library a function that 
> reads directly from the buffer.

Ok where can I read about this function? How does treesitter handle incremental 
parses which are state-dependent? For example PHPs lex-analyzer works 
differently in different states of the grammar, like do you signal to 
treesitter a point in the buffer so it can backtrack the parsers states in 
order to correctly perform a incremental parse on the new content?

> 
>> 
>> Does treesitter expose a (faster) regexp matcher that perhaps can be used by 
>> my library?
> 
> Not that I know of. 
> 
> IIUC, tree-sitter integration doesn’t have much to do with proposed 
> emacs-parser-generator, it just exposes tree-sitter to Emacs, and adds some 
> integration to font-lock and indentation that leverages tree-sitter features; 
> whereas emacs-parser-generator seems to be about defining grammar and 
> generating 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
 
Regards
Christian


reply via email to

[Prev in Thread] Current Thread [Next in Thread]