New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for infinite loops detection and reporting #23
Comments
This is in relation with the idea to fully support left recursive grammars #5 |
Another example of infinite loop is using expression that could succeed without consuming any input in repetition. For example, using Optional inside ZeroOrMore. |
Interesting problem. Any ideas how to solve this issue? Best I've found were: Alternatively, you could limit nesting within a AST via some kind of decrementing counter. |
Thanks for the link. There are several papers published on the subject. I had plans to support left recursive grammars (there is still issue registered) but I'm not so sure anymore that it is the right way to go. PEGs have a nice property that they are representation of recursive descent parser and thus are easy to reason about and debug. Introducing support for left recursion would break that simplicity. For the time being I think that detection of infinite loops on the grammar level is good enough. |
In the case of left recursive grammar Arpeggio will end with
RecursionError
.It would be nice to have a detailed report why that happen and where in the grammar is the left recursive loop.
The text was updated successfully, but these errors were encountered: