antlr / antlr/antlr4

Can't find rule grammarSpec or tree structure error while using direct left recursion

Open
#301 2 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

A simple term rule:

```
term[int priority]
: simpleTerm
| term[$priority - 1]
;
```

will throw cannot find rule grammarSpec error. Removing the direct left recursion removes the error.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the grammar shown in the issue and capture the full “cannot find rule grammarSpec” or tree-structure error. Trace how ANTLR handles direct left recursion with the parameterized term rule; done means the grammar is processed without that error and the existing behavior remains valid.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.