SabelCC example

Package SimpleMath;

Tokens
  l_paren = '(';
  r_paren = ')';
  plus = '+';
  minus = '-';
  mult = '*';
  div = '/';
  number = ['0'..'9']+;
  blank = [' ' 9 12 8 11 13 10];

Ignored Tokens
  blank;

Productions
  expr   = {term}   term
         | {plus}   expr plus  term
         | {minus}  expr minus term ;
  term   = {factor} factor
         | {mult}   term mult factor
         | {div}    term div  factor ;
  factor = {number} number
         | {expr}   l_paren expr r_paren ;