anchor.diff:      |   LPAREN STRING g = expr RPAREN {
               $value = $g.value;
               System.out.println($STRING.text + " " + $g.value);
  +        }
  +    |   LPAREN letsinglevar IN p=expr RPAREN{
  +            $value = $p.value;
           }
       |   n=var {$value = $n.value;}
       ;
  
positive.code:     |   LPAREN SIN {System.err.println("sin only takes 1 argument");}
          ( var )+
          RPAREN
      |   LPAREN SQRT {$value = 0;}
          ( m=expr {$value = Math.sqrt($m.value);})
          RPAREN
  
negative.code:             String removedCommas = ($NUMBER.text).replace(",", "");
              $value = Double.parseDouble(removedCommas);
          }
      |   SINGLEVAR
          {
          Double v = (Double)memory.get($SINGLEVAR.text);
          if ( v!=null ) $value = v.doubleValue();
          else System.err.println("undefined variable "+$SINGLEVAR.text);
          }
      ;
  
  letsinglevar 
      :   LET SINGLEVAR BE h = expr{
          memory.put($SINGLEVAR.text, new Double($h.value));
          }
              
      ;
  
  STRING
      :   '"' (~[\r\n"] | '""')* '"'
      ;
  
  
  LET: 'let';
  IN: 'in';
  BE: 'be';
  SIN: 'sin';
  COS: 'cos';
  SQRT: 'sqrt';
  SINGLEVAR: ('a'..'z'|'A'..'Z');
  ID  :   ('a'..'z'|'A'..'Z')+ ;
  NUMBER :  ('0'..'9'|',')+ ('.' ('0'..'9')+)?;
  NEWLINE:'\r'? '\n' ;
  