From: Yuan Fu <casouri@gmail.com>
To: "Mattias Engdegård" <mattiase@acm.org>
Cc: luangruo@yahoo.com, 59426@debbugs.gnu.org,
Eli Zaretskii <eliz@gnu.org>,
stefankangas@gmail.com
Subject: bug#59426: 29.0.50; [tree-sitter] Some functions exceed maximum recursion limit
Date: Mon, 21 Nov 2022 11:00:56 -0800 [thread overview]
Message-ID: <A4A74330-8EE9-4ABC-BD46-C5BDD3FB358B@gmail.com> (raw)
In-Reply-To: <B55DFBE6-D8D9-4E1C-987A-0E47303599D5@acm.org>
> 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
next prev parent reply other threads:[~2022-11-21 19:00 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-21 0:53 bug#59426: 29.0.50; [tree-sitter] Some functions exceed maximum recursion limit Yuan Fu
2022-11-21 6:40 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-21 7:38 ` Stefan Kangas
2022-11-21 12:00 ` Mattias Engdegård
2022-11-21 13:55 ` Eli Zaretskii
2022-11-21 14:46 ` Mattias Engdegård
2022-11-21 16:43 ` Yuan Fu
2022-11-21 16:54 ` Eli Zaretskii
2022-11-21 17:10 ` Eli Zaretskii
2022-11-21 17:45 ` Eli Zaretskii
2022-11-21 18:20 ` Mattias Engdegård
2022-11-21 18:26 ` Eli Zaretskii
2022-11-21 18:59 ` Mattias Engdegård
2022-11-21 19:00 ` Yuan Fu [this message]
2022-11-22 9:08 ` Mattias Engdegård
2022-11-22 23:19 ` Yuan Fu
2022-11-23 10:40 ` Mattias Engdegård
2022-11-23 18:46 ` Yuan Fu
2022-11-23 20:01 ` Mattias Engdegård
2022-11-24 9:17 ` Yuan Fu
2022-11-24 10:24 ` Mattias Engdegård
2022-11-24 19:25 ` Yuan Fu
2022-11-24 19:28 ` Eli Zaretskii
2022-11-27 2:36 ` Yuan Fu
2022-11-24 10:24 ` Eli Zaretskii
2022-11-21 16:56 ` Mattias Engdegård
2022-11-21 17:01 ` Yuan Fu
2022-11-21 17:44 ` Eli Zaretskii
2022-11-22 1:46 ` Stefan Kangas
2022-11-22 0:27 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-22 8:59 ` Mattias Engdegård
2022-11-21 13:19 ` Eli Zaretskii
2022-11-21 16:52 ` Yuan Fu
2022-11-21 17:16 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=A4A74330-8EE9-4ABC-BD46-C5BDD3FB358B@gmail.com \
--to=casouri@gmail.com \
--cc=59426@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=luangruo@yahoo.com \
--cc=mattiase@acm.org \
--cc=stefankangas@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.