title: Concatenation shift-reduce conflict
body: <p>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.</p>
  
  <p><strong>Grammar:</strong></p>
  
  <pre><code>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
  </code></pre>
  
  <p><strong>Input:</strong></p>
  
  <pre><code>x + x + (x)            // match
  "foo" + x              // match
  (("goo") + (((y))))    // match
  
  function_name() + x + "foo" + (other_func())    // what I also want
  </code></pre>
  
  <p><strong>Conflict:</strong></p>
  
  <pre><code>Warning : *** Shift/Reduce conflict found in state #12
  between literal ::= IDENTIFIER (*) 
  and     literal ::= IDENTIFIER (*) LPAREN RPAREN  
  under symbol LPAREN
  </code></pre>
  
  <p>I have tried many different things like hiding identifier like <code>IDENTIFIER second</code> at literal and <code>second ::= | LPAREN RPAREN;</code> but I can't make it work.</p>