Skip to content

[FEATURE] flatten SplitRecursively's recursive function calls by using an explicit stackΒ #898

@georgeh0

Description

@georgeh0

In #897 we set a recursion depth limit for SplitRecursively as a stop gap, to avoid stack overflow. But it means sometimes the split quality will be affected when the AST layer is very deep. e.g. some languages's AST uses tail-recursion style to define lists, which may cause deep AST.

A few test cases that we encountered with deep AST:

We want to flatten the recursive calls, by explicitly managing a stack (e.g. use a Vec). In such case the space is allocated on the heap instead of stack, which has much much higher size limit.


❀️ Contributors, please refer to πŸ“™Contributing Guide.
Unless the PR can be sent immediately (e.g. just a few lines of code), we recommend you to leave a comment on the issue like I'm working on it or Can I work on this issue? to avoid duplicating work. Our Discord server is always open and friendly.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions