Error about Immediate left recursion in ANTLR4

Solution 1:

As mentioned by Kaby76 in the comments, this alternative:

expr
 : ...
 | (expr)
 | ...
 ;

is the cause. You probably meant to do this:

expr
 : ...
 | '(' expr ')'
 | ...
 ;