anchor.diff:      
   statement
       : declaration
  -    | rule_definition
  +    | term     // <number-typed> term;
       ;
   
   declaration
  
positive.code: PLUS                    : '+' ;
  SUBTRACT                : '-' ;
  // Comparison
  EQUAL                   : '=' ;
  NOT_EQUAL               : '!=' ;
  // Brackets
  OPEN_PAREN              : '(' ;
  CLOSE_PAREN             : ')' ;
  
negative.code:     | RANDOM name=symbol ':' parameters+=symbol (X parameters+=symbol)* '->' range=symbol
      ;
      
  term
        // parenthesis, e.g.:(1+2)
      : '(' term ')' #parentheses
        // function application, e.g.: f(X)
      | functor=symbol '(' ( args+=term (',' args+=term)* )? ')' #functionApplication
        // not, e.g.: not A and B -> (not(A)) and B
      | NOT term #not // <boolean-typed> term
         // negative, e.g.: 2 * -1 -> 2 * (-1)
       | '-' term #negative // We set the unary minus to higher precedence // <number-typed> term;
         // NOTE:  P)arentheses, E)xponents, ( M)ultiplication, D)ivision ), ( A)ddition, S)ubtraction )
         // see: http://en.wikipedia.org/wiki/Order_of_operations
  	  // exponentiation, e.g. 2^3^4 ---> 2^(3^4)
  	|  <assoc=right> base=term '^' exponent=term #exponentiation // <number-typed> term;
  	  // multiplication or division, e.g.: 2*3/2 ---> 2*(3/2)
  	| leftop=term op=('*' | '/') rightop=term #multiplicationOrDivision // <number-typed> term;
  	  // addition or subtraction, e.g.: 1-2+3 ---> (1-2)+3
  	| leftop=term op=('+' | '-') rightop=term #additionOrSubtraction // <number-typed> term;
        // comparison operators, e.g.: X = Y, 2 < 3
      | leftop=term op=('<' | '<=' | '=' | '!=' | '>=' | '>') rightop=term #comparison
        // conjunction, e.g.: A or B and C ---> A or (B and C)
      | leftconj=term AND rightconj=term #conjunction // <boolean-typed> terms
        // disjunction, e.g.: A => B or C ---> A => (B or C)
      | leftconj=term OR rightconj=term #disjunction // <boolean-typed> terms
        // implication, e.g.: A = B => C = D
      |<assoc=right> antecedent=term IMPLICATION consequent=term #implication // <boolean-typed> terms
        // biconditional, e.g.: A = B <=> C = D
      |<assoc=right> leftop=term BICONDITIONAL rightop=term #biconditional // <boolean-typed> terms
        // conditional, e.g.: if X = Y then 1 else 2
      | IF condition=term THEN thenbranch=term ELSE elsebranch=term #conditional // same type terms on all leafs
        // universal quantification, e.g.: for all X : X != a
      | FOR ALL index=variable ':' body=term #forAll  // <boolean-typed> terms
        // existential quantification, e.g.: there exists X : X = a
      | THERE EXISTS index=variable ':' body=term #thereExists // <boolean-typed> terms
      //| formula=term number_typed_term=term #shorthandpotential // parse it as formula (i.e. <boolean-typed> term) and <number-typed> term, create if Formula then <number-typed> term else 1 - <number-typed> term
      | constant #termConstant
      | variable #termVaria
      ;
      
  constant
      : CONSTANT
      | INTEGER
      | RATIONAL
      ;
      
  variable
      : VARIABLE
      ;
  
  symbol
  