Closed xie-dongping closed 7 years ago
I understand that the grammar defined above is ambiguous, and it is only used to illustrate the point, that I understand the or
operator in a different way.
@xie-dongping Infinite left recursion is a known problem. There is an experimental branch declarative-api
where I've added, among other things, automatic detection of left recursion that shows the problematic piece of your grammar. See also the description of the problem in the docs.
Thank you for the reference! I've also solved my problem!
Consider the following simple and fictive example:
I encounter the case when writing a toy parser for a modeling language.
I'm not really familiar with the parsing theory, so I was wondering if this is the intended behavior for a parser combinator?
If it is not, how may I fix the
__or__
method of theParser
class (maybe even more)? I thought about propagating the exceptions back to the__or__
method, or maybe you would have a better idea?