anchor.diff:     ;
   
   factor
  -   : atom (POW atom)*
  +   : signedAtom (POW signedAtom)*
  +   ;
  +
  +signedAtom //allows for expressions like --++--1
  +   : (MINUS | PLUS)? atom
      ;
   
   atom
  -   : scientific
  -   | variable
  +   : SCIENTIFIC_NUMBER
  +   | VARIABLE
      | LPAREN expression RPAREN
  -   ;
  -
  -scientific
  -   : number (E number)?
      ;
   
   relop
  
positive.code:    : '.'
     ;
  
  
  E
     : 'e' | 'E'
     ;
  
  
  POW
     : '^'
     ;
  
  
  WS
     : [ \r\n\t] + -> channel (HIDDEN)
     ;
  
negative.code:    | LT
     ;
  
  VARIABLE
     : VALID_ID_START VALID_ID_CHAR*
     ;
  
  fragment
  VALID_ID_START
     : ('a'..'z')
     | ('A'..'Z')
     | '_'
     ;
  
  fragment
  VALID_ID_CHAR
     : VALID_ID_START
     | ('0'..'9')
     ;
  
  SCIENTIFIC_NUMBER
     : NUMBER(E SIGN? NUMBER)?
     ; //The integer part gets its potential sign from the signedAtom rule
  
  fragment
  NUMBER
     : ('0'..'9')+ ('.' ('0'..'9')+)?
     ;
  
  fragment
  E
     : 'E'
     | 'e'
     ;
  
  fragment
  SIGN
     : ('+' | '-')
     ;
  
  LPAREN
     : '('
  