title: ANTLR grammar error
body: <p>I'm trying to built C-- compiler using ANTLR 3.4.</p>
  
  <p>Full set of the grammar listed here,</p>
  
  <pre><code>program         : (vardeclaration | fundeclaration)*                    ;
  vardeclaration  : INT ID (OPENSQ NUM CLOSESQ)? SEMICOL  ;
  
  fundeclaration  : typespecifier ID OPENP params CLOSEP compoundstmt     ;
  typespecifier   : INT | VOID                                            ;
  params          : VOID | paramlist                                      ;
  paramlist       : param (COMMA param)*                                  ;
  param           :  INT ID (OPENSQ CLOSESQ)?         ;
  
  compoundstmt    : OPENCUR vardeclaration* statement* CLOSECUR           ;
  statementlist   : statement*                                            ;
  
  statement       : expressionstmt | compoundstmt | selectionstmt | iterationstmt | returnstmt;
  expressionstmt  : (expression)? SEMICOL;
  selectionstmt   : IF OPENP expression CLOSEP statement (options {greedy=true;}: ELSE statement)?;
  iterationstmt   : WHILE OPENP expression CLOSEP statement;
  returnstmt      : RETURN (expression)? SEMICOL;
  
  expression      : (var EQUAL expression) | sampleexpression;
  var             : ID ( OPENSQ expression CLOSESQ )? ;
  
  sampleexpression: addexpr ( ( LOREQ | LESS | GRTR | GOREQ | EQUAL | NTEQL) addexpr)?;
  addexpr         : mulexpr ( ( PLUS | MINUS ) mulexpr)*;
  mulexpr         : factor  ( ( MULTI | DIV  ) factor )*; 
  
  factor          : ( OPENP expression CLOSEP ) | var | call  | NUM;
  call            : ID OPENP arglist? CLOSEP;
  arglist         : expression ( COMMA expression)*;
  </code></pre>
  
  <p>Used lexer rules as following,</p>
  
  <pre><code>ELSE    : 'else'    ;
  IF      : 'if'      ;
  INT     : 'int'     ;
  RETURN  : 'return'  ;
  VOID    : 'void'    ;
  WHILE   : 'while'   ;
  
  PLUS    : '+' ;
  MINUS   : '-' ;
  MULTI   : '*' ;
  DIV     : '/' ;
  
  LESS    : '&lt;'  ;
  LOREQ   : '&lt;=' ;
  GRTR    : '&gt;'  ;
  GOREQ   : '&gt;=' ;
  
  EQUAL   : '==' ;
  NTEQL   : '!=' ;
  ASSIGN  : '='  ;
  
  SEMICOL : ';' ;
  COMMA   : ',' ;
  
  OPENP   : '(' ;
  CLOSEP  : ')' ;
  OPENSQ  : '[' ;
  CLOSESQ : ']' ;
  OPENCUR : '{' ;
  CLOSECUR: '}' ;
  
  SCOMMENT: '/*' ;
  ECOMMENT: '*/' ;
  
  
  ID  : ('a'..'z' | 'A'..'Z')+/*(' ')*/ ;
  NUM : ('0'..'9')+ ;
  WS  : (' ' | '\t' | '\n' | '\r')+ {$channel = HIDDEN;};
  COMMENT: '/*' .* '*/' {$channel = HIDDEN;};
  </code></pre>
  
  <p>But I try to save this it give me the error,</p>
  
  <pre><code>error(211): /CMinusMinus/src/CMinusMinus/CMinusMinus.g:33:13: [fatal] rule expression has non-LL(*) decision due to recursive rule invocations reachable from alts 1,2.  Resolve by left-factoring or using syntactic predicates or using backtrack=true option.
   |---&gt; expression       : (var EQUAL expression) | sampleexpression;
  
  1 error
  </code></pre>
  
  <p>How can I resolve this problem?</p>