Example for a text grammar file

F   :  [0-9]+ 
    | "(" ws E ws ")" ;

T   :  F ( ws "*" ws F )* ;

E   :  T ( ws "+" ws T )* ;

ws  :  [\ \t\r\n]* ;
                                                                                                                                                             
%start E;
by Stephan Michels