title: Why occurs 'no viable alternative at input'?
body: <p>I wrote the following combined grammar:</p>
  
  <pre><code>grammar KeywordGrammar;
  
  options{
  TokenLabelType = MyToken;
  }
  
  //start rule
  start: sequence+ EOF;
  
  sequence: keyword filter?;
  
  filter: simpleFilter | logicalFilter | rangeFilter;
  
  logicalFilter: andFilter | orFilter | notFilter;
  
  simpleFilter: lessFilter | greatFilter | equalFilter | containsFilter;
  
  andFilter: simpleFilter AND? simpleFilter;
  
  orFilter: simpleFilter OR simpleFilter;
  
  lessFilter: LESS (DIGIT | FLOAT|DATE);
  
  notFilter: NOT IN? (STRING|ID);
  
  greatFilter: GREATER (DIGIT|FLOAT|DATE);
  
  equalFilter: EQUAL (DIGIT|FLOAT|DATE);
  
  containsFilter: EQUAL (STRING|ID);
  
  rangeFilter:  RANGE? DATE DATE? | RANGE? FLOAT FLOAT?; 
  
  keyword: ID | STRING;
  
  DATE: DIGIT DIGIT? SEPARATOR MONTH SEPARATOR DIGIT DIGIT (DIGIT DIGIT)?;
  
  MONTH: JAN
       | FEV 
       | MAR
       | APR
       | MAY
       | JUN
       | JUL
       | AUG
       | SEP
       | OCT
       | NOV
       | DEC
       ;
  
  JAN : 'janeiro'|'jan'|'01'|'1';
  FEV : 'fevereiro'|'fev'|'02'|'2';
  MAR : 'março'|'mar'|'03'|'3';
  APR : 'abril' |'abril'|'04'|'4';
  MAY : 'maio'| 'mai'| '05'|'5';
  JUN : 'junho'|'jun'|'06'|'6';
  JUL : 'julho'|'jul'|'07'|'7';
  AUG : 'agosto'|'ago'|'08'|'8';
  SEP : 'setembro'|'set'|'09'|'9';
  OCT : 'outubro'|'out'|'10';
  NOV : 'novembro'|'nov'|'11';
  DEC : 'dezembro'|'dez'|'12';
  
  SEPARATOR: '/'|'-';
  
  AND: ('e'|'E');
  
  OR: ('O'|'o')('U'|'u');
  
  NOT: ('N'|'n')('Ã'|'ã')('O'|'o');
  
  IN: ('E'|'e')('M'|'m');
  
  GREATER: '&gt;' | ('m'|'M')('a'|'A')('i'|'I')('o'|'O')('r'|'R') ;
  
  LESS: '&lt;' | ('m'|'M')('e'|'E')('n'|'N')('o'|'O')('r'|'R');
  
  EQUAL: '=' | ('i'|'I')('g'|'G')('u'|'U')('a'|'A')('l'|'L');
  
  RANGE: ('e'|'E')('n'|'N')('t'|'T')('r'|'R')('e'|'E');
  
  FLOAT: DIGIT+ | DIGIT+ POINT DIGIT+;
  
  ID: (LETTER|DIGIT+ SYMBOL) (LETTER|SYMBOL|DIGIT)*;
  
  STRING: '"' ( ESC_SEQ | ~('\\'|'"') )* '"';
  
  DIGIT: [0-9];
  
  WS: (' '
    |  '\t'
    |  '\r'
    |  '\n') -&gt; skip
    ;
  
  POINT: '.' | ',';
  
  fragment 
  LETTER: 'A'..'Z'
        | 'a'..'z'
        | '\u00C0'..'\u00D6'
        | '\u00D8'..'\u00F6'
        | '\u00F8'..'\u02FF'
        | '\u0370'..'\u037D'
        | '\u037F'..'\u1FFF'
        | '\u200C'..'\u200D'
        | '\u2070'..'\u218F'
        | '\u2C00'..'\u2FEF'
        | '\u3001'..'\uD7FF'
        | '\uF900'..'\uFDCF'
        | '\uFDF0'..'\uFFFD'
        ;
  
  fragment 
  SYMBOL: '-' | '_';
  
  fragment
  HEX_DIGIT: ('0'..'9'|'a'..'f'|'A'..'F');
  
  fragment
  ESC_SEQ: '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\')
         | UNICODE_ESC
         | OCTAL_ESC
         ;
  
  fragment
  OCTAL_ESC: '\\' ('0'..'3') ('0'..'7') ('0'..'7')
           | '\\' ('0'..'7') ('0'..'7')
           | '\\' ('0'..'7')
           ;
  
  fragment
  UNICODE_ESC: '\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT;
  </code></pre>
  
  <p>But a <strong>no viable alternative at input</strong> error occurs only trying parse a following type of sentences: <strong><em>keyword OPERATOR DIGIT</em></strong>; for example:</p>
  
  <ul>
  <li>filter = 2</li>
  <li>filter &lt; 2</li>
  <li>filter > 2</li>
  </ul>
  
  <p>Zero as a value, it works!!!</p>
  
  <p>Where is the error?</p>
  
  <p>Thanks by your help,</p>
  
  <p>Yenier</p>