Closed thelmuth closed 4 years ago
Merged although I note that the recursion in the depth checker could itself overflow the Java call stack if the limit is too high. Alternative approaches might use zippers or a traversal of a printed representation of the tree that increments/decrements a counter as parentheses are processed... but probably this isn't necessary.
Good point. I'm not sure why this didn't happen in my tests. I'm guessing because the max-points limit I used (5000) doesn't allow code to get big enough for this to hit the recursion limit. I'm going to try some limited tests with a bigger max-points to see what happens.
Yup, my larger trials show that the new function causes stack overflows, as you expected. I'll work on a replacement.
While the string approach sounds easiest, I'm wary because I'd have to be careful about things like strings that contain parentheses, parenthesis character literals, etc.
This fixes the nested depth StackOverflow with some code stack instructions.