title: How to define logical operator with parenthesis in ANTLR grammar
body: <p>I am defining a grammar in ANTLR that will express an expression which includes logical operator and parenthesis together. 
  <br>
  Here is the grammar </p>
  
  <pre><code>grammar simpleGrammar; 
  
  /* This will be the entry point of the parser. */ 
  
  parse 
      :   
          expression EOF 
      ; 
  expression 
      :   
          expression binOp expression | ID | unOp (expression) | '(' expression ')' 
      ; 
  binOp 
      : 
          ('AND' | 'OR')  
      ; 
  unOp 
      : 
          'NOT' 
      ; 
  ID      :   
          ('a'..'z' | 'A'..'Z')+  
      ; 
  </code></pre>
  
  <p>The defined grammar can able to express parse tree without parenthesis but when I input an example with parenthesis for example, <code>(Apple OR Bananana)AND Orange</code>
  It is showing <code>MismatchedTokenException</code> 
  <br>
  So, It will be really appreciated if someone explains how to define the grammar in order to express the parenthesis.</p>