code: public <T> T evaluate(Evaluator<T> eval) throws IllegalArgumentException {
          try {
              Deque<T> stack = new ArrayDeque<>();
              for (Term<?> t : this) {
                  if (t instanceof TermOperator) {
                      T val;
                      if (((TermOperator) t).getValue() == '~') {
                          T val1 = stack.pop();
                          val = eval.evaluateOperator(val1, (TermOperator) t);
                      } else {
                          T val2 = stack.pop();
                          T val1 = stack.pop();
                          val = eval.evaluateOperator(val1, val2, (TermOperator) t);
                      }
                      stack.push(val);
                  } else if (t instanceof TermFloatValue) {
                      T val = eval.evaluateArgument((TermFloatValue) t);
                      stack.push(val);
                  }
              }
              return stack.peek();
          } catch (NoSuchElementException e) {
              throw new IllegalArgumentException("Couldn't evaluate calc() expression", e);
          }
      }
docs: =========================================================================