I have a simple grammar for JavaCUP's LR(1) parser that recognises concatenation expressions of identifiers and strings. I also want to add some empty function calls as a possible concatenation argument. However, when I try that, it leads to a shift/reduce conflict.
Grammar:
precedence left PLUS;
e ::= e exp
      | exp;
exp ::= concat
      | literal;
concatenation ::= exp PLUS exp
                | LPAREN exp RPAREN;
literal ::= IDENTIFIER
          | STRING
          | IDENTIFIER LPAREN RPAREN; // THIS PRODUCES THE ERROR
Input:
x + x + (x)            // match
"foo" + x              // match
(("goo") + (((y))))    // match
function_name() + x + "foo" + (other_func())    // what I also want
Conflict:
Warning : *** Shift/Reduce conflict found in state #12
between literal ::= IDENTIFIER (*) 
and     literal ::= IDENTIFIER (*) LPAREN RPAREN  
under symbol LPAREN
I have tried many different things like hiding identifier like IDENTIFIER second at literal and second ::= | LPAREN RPAREN; but I can't make it work.