-
Notifications
You must be signed in to change notification settings - Fork 42
Description
It seems that idiomatically written expression parsers cannot handle more than a few dozen nesting levels before triggering a RecursionError with Python's default recursion limit. For example, the calculator example from the documentation can't handle the expression
1+(1+(1+( ... 1+(1) ... )))
with 46 pairs of nested parentheses. The number of nested function calls produced by parsy seems to increase more or less linearly with the nesting depth of the expression, so one workaround is to temporarily increase the recursion limit.
I ran into this issue when using a more complex parser on some computer-generated code. It seemed to have a nesting depth of about 10, but the number of calls per nesting level is likely higher than with the calculator example, since I have many more expression types.