antlr / antlr/antlr4

Redundant mutually left-recursive sets

Open
#498 4 comments 0 reactions 0 assignees View on GitHub
comp:tool type:bug
Dominant language
Java
Stars
19k
Forks
3.5k
PR merge metrics
No merged PRs in 30d

Description

```
[ERROR] error(119): JavaParser2.g4::: The following sets of rules are mutually left-recursive [primary, classInstanceCreationExpression, fieldAccess, methodInvocation, methodReference, primaryNoNewArray, arrayAccess] and [primaryNoNewArray, arrayAccess, fieldAccess, primary, classInstanceCreationExpression, methodInvocation, methodReference]
```

`[primary, classInstanceCreationExpression, fieldAccess, methodInvocation, methodReference, primaryNoNewArray, arrayAccess]`
and
`[primaryNoNewArray, arrayAccess, fieldAccess, primary, classInstanceCreationExpression, methodInvocation, methodReference]`

contain the exactly same elements and shouldn't be reported as two separate sets.

Contributor guide

Open the contributing guide

Research direction

Start by locating the mutually left-recursive rule analysis that produces the diagnostic for JavaParser2.g4 and reproduce the report shown in the issue. Trace how recursive rule sets are collected and compared; done means identical sets are reported only once, with the existing diagnostic still correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.