Parser issues mutual left recursion error when the left-recursive part of a rule is in parenthesis
- Dominant language
- Java
- Stars
- 19k
- Forks
- 3.5k
- PR merge metrics
- No merged PRs in 30d
Description
Here is the description of this problem from stackoverflow:
http://stackoverflow.com/questions/23626376/antlr4-mutual-left-recursion
Here is the issue:
```
classOrInterfaceType
: (classOrInterfaceType) '.' Identifier
| Identifier
;
```
This provokes a mutually left recursion error. When removing the parenthesis around classOrInterfaceType, then everything is fine. The parentheses are superfluous but are inserted by some grammar generation tools, so it would be fine if this would work!
Contributor guide
Research direction
No implementation file or test is named. Start with the parenthesized grammar example and the linked Stack Overflow discussion, then trace ANTLR's left-recursion analysis; done when this valid form no longer triggers a mutual-left-recursion error while genuinely invalid cases still do.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100