How to do Priority of Operations (+ * - /) in my grammars?
<p>I define my own grammars using antlr 4 and I want to build tree true According to Priority of Operations (+ * - /) ....</p>

<p>I find sample on do Priority of Operations (* +) it work fine ... </p>

<p>I try to edit it to add the Priority of Operations (- /) but I failed :(</p>

<p>the grammars for Priority of Operations (+ *) is :</p>

<pre><code> println:PRINTLN  expression SEMICOLON {System.out.println($expression.value);};
 expression returns [Object value]:
  t1=factor {$value=(int)$t1.value;}
  (PLUS t2=factor{$value=(int)$value+(int)$t2.value;})*;

  factor returns [Object value]: t1=term {$value=(int)$t1.value;}
  (MULT t2=term{$value=(int)$value*(int)$t2.value;})*;

 term returns [Object value]:
  NUMBER {$value=Integer.parseInt($NUMBER.text);}
   | ID {$value=symbolTable.get($value=$ID.text);}
   | PAR_OPEN expression {$value=$expression.value;} PAR_CLOSE
   ;
MULT :'*';
PLUS :'+';

MINUS:'-';
DIV:'/' ; 
</code></pre>

<p>How I can add to them the Priority of Operations (- /) ?</p>