anchor.diff:         // conditional, e.g.: if X = Y then 1 else 2
        | IF condition=expr THEN thenbranch=expr ELSE elsebranch=expr #ifThenElse
          // lambda, e.g.: lambda f(X) : 2 + f(X)
  -     | LAMBDA ( parameters+=expr (',' parameters+=expr)* )? ':' body=expr #lamda
  +     | expr_lambda #lamda
          // universal quantification, e.g.: for all X : X != a
        | FOR ALL index=expr ':' body=expr #forAll
          // existential quantification, e.g.: there exists X : X = a
        | THERE EXISTS index=expr ':' body=expr #thereExists
          // cartesian product
  -     | firstarg=SYMBOLIC_NAME (CARTESIAN_PRODUCT additionalargs+=SYMBOLIC_NAME)+ #cartesianProduct
  +     | firstarg=expr_constant_name (X additionalargs+=expr_constant_name)+ #cartesianProduct
          // function type
  -     | domaintypes+=SYMBOLIC_NAME (CARTESIAN_PRODUCT domaintypes+=SYMBOLIC_NAME)* FUNCTION_TYPE rangetype=SYMBOLIC_NAME #functionType
  -       // a symbol
  -       // NOTE: even though the SYMBOLIC_NAME pattern should match these keywords
  -       // ANTLR excludes the set of keywords/tokens that are used from matching
  -       // this pattern (see chapter5 of reference manual). Therefore, we
  -       // need to explicitly list all of the keywords and operators that we
  -       // want also to be interpreted as Symbols.
  -     | (NOT | AND | OR | FOR | ALL | THERE | EXISTS // Keywords
  -        | LAMBDA | IF | THEN | ELSE
  -        | INTERSECTION | UNION
  -        | ON | IN
  -        | CARTESIAN_PRODUCT | FUNCTION_TYPE
  -        | IMPLICATION | BICONDITIONAL // Logic Operators
  -        | EXPONENTIATION | DIVIDE | TIMES | PLUS | SUBTRACT // Arithmetic
  -        | LESS_THAN_EQUAL | EQUAL | NOT_EQUAL | GREATER_THAN_EQUAL // Comparison, Note: We intentionally exclude '<' and '>' as these can affect parsing of an expression symbol
  -        | COLON | VERT_BAR | UNDERSCORE | PERIOD // Misc
  -        | RATIONAL | SYMBOLIC_NAME) #symbol
  +     | domaintypes+=expr_constant_name (X domaintypes+=expr_constant_name)* FUNCTION_TYPE rangetype=expr_constant_name #functionType
  +     | expr_symbol #symbol
        ;
  +     
  +expr_function_application
  +     : functor=expr_functor '(' ( args+=expr (',' args+=expr)* )? ')'
  +     ;
  +     
  +expr_functor
  +    : expr_symbol          #functorSymbol
  +    | '(' lambda=expr_lambda ')'  #functorLambda
  +    | functor=expr_symbol '(' ( args+=expr (',' args+=expr)* )? ')' #functorFunctionApplication
  +    ;    
  +    
  +expr_lambda
  +    : LAMBDA ( parameters+=expr (',' parameters+=expr)* )? ':' body=expr
  +    ; 
  +     
  +expr_symbol
  +    : expr_constant_name
  +    | expr_constant_number
  +      // NOTE: even though the expr_constant_name pattern should match these keywords
  +      // ANTLR excludes the set of keywords/tokens that are used from matching
  +      // this pattern (see chapter5 of reference manual). Therefore, we
  +      // need to explicitly list all of the keywords and operators that we
  +      // want also to be interpreted as Symbols.
  +    | NOT | AND | OR | FOR | ALL | THERE | EXISTS // Keywords
  +    | LAMBDA | IF | THEN | ELSE
  +    | INTERSECTION | UNION
  +    | ON | IN
  +    | X | FUNCTION_TYPE
  +    | IMPLICATION | BICONDITIONAL // Logic Operators
  +    | EXPONENTIATION | DIVIDE | TIMES | PLUS | SUBTRACT // Arithmetic
  +    | LESS_THAN_EQUAL | EQUAL | NOT_EQUAL | GREATER_THAN_EQUAL // Comparison
  +    | COLON | VERT_BAR | UNDERSCORE | PERIOD // Misc    
  +    ;
  +    
  +expr_constant_name
  +    : CONSTANT_STR
  +    | QUOTED_CONSTANT_STR
  +    ;
  +    
  +expr_constant_number
  +    : INTEGER
  +    | RATIONAL
  +    ;
   
   /*
       The lexer tokenizes the input string that the parser is asked to
  
positive.code: UNDERSCORE              : '_' ;
  PERIOD                  : '.' ;
  
  RATIONAL
      : ('0' | '1'..'9' '0'..'9'*)
      | ('0'..'9')+ '.' ('0'..'9')+ EXPONENT? FLOAT_TYPE_SUFFIX?
  
negative.code:        // an expression symbol, e.g.:<X + Y>
       | '<' expr '>' #expressionSymbol
         // function application, e.g.: f(X)
       | expr_function_application # functionApplication
         // tuple, e.g.: (A, B, C)
       | '(' expr ',' expr (',' expr)* ')' #tuple
         // counting formula, e.g.: | X in 1..10 : X < 5 |
  