title: unary negation in parsing java
body: <p>What I am trying to do is allowing expression like 8 - - - 2 + 3.</p>
  <pre><code>program ::= expr:e
              {: RESULT = ...; :}
           ;
  
  expr ::= INTCONST:c
           {: RESULT = ...; :}
        |  binaryExpr:e
           {: RESULT = e;   :}
        |  LPAREN expr:e RPAREN
           {: RESULT = e;   :}
        |  MINUS expr:e               
           {: RESULT = - e; :}
           %prec UMINUS
        ;
  
  binaryExpr ::= expr:e1 PLUS expr:e2
                 {: RESULT = ... :}
                 expr:e1 MINUS expr:e2
                 {: RESULT = ... :}
  
  </code></pre>
  <p>For the unary negation, I tried this</p>
  <pre><code>      |  MINUS expr:e               
           {: RESULT = - e; :}
           %prec UMINUS
  </code></pre>
  <p>, but it says that the negative sign is a bad operand type.</p>
  <p>Is there any tips to do unary negation?</p>