bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#59426: 29.0.50; [tree-sitter] Some functions exceed maximum recursio


From: Yuan Fu
Subject: bug#59426: 29.0.50; [tree-sitter] Some functions exceed maximum recursion limit
Date: Mon, 21 Nov 2022 11:00:56 -0800


> On Nov 21, 2022, at 10:20 AM, Mattias Engdegård <mattiase@acm.org> wrote:
> 
>> And don't forget that GC is also highly recursive and eats up a lot of stack 
>> space.
> 
> Not any more.
> 
> ---
> 
> If tree-sitter really needs a deep stack whose size depend on the input file 
> and grammar in an unbounded way, then it shouldn't use the C stack; that 
> would be an unnecessary restriction on the files that could be edited. A 
> dynamically allocated stack could still have a limit, but it would be 
> decoupled from the C stack size.

Fortunately tree-sitter doesn’t need a deep stack. I don’t think any 
human-written or even machine generated source file is ever intended to parse 
into a tree of more than 1k level. Eg, who would write/generate a function that 
has thousands level of nested brackets {{{{{{{{{{{{{{{{…. ? (Unless they want 
to try to break the parser/compiler.) So a sane limit is more than enough, just 
to guard against weird source files that makes the parser (erroneously) 
generate very very tall trees.

Yuan




reply via email to

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