code: public List<Expression<E>> rpn(List<Expression<E>> tokens)
              throws CompileLogicException {
          // intermediate storage
          Stack<Expression<E>> stack = new Stack<Expression<E>>();
  
          // final rpn output
          LinkedList<Expression<E>> output = new LinkedList<Expression<E>>();
  
          for (Expression<E> tok : tokens) {
              if (tok instanceof Paren.L<?>) {
                  stack.push(tok);
              } else if (tok instanceof Paren.R<?>) {
                  Expression<E> top;
                  do {
                      top = stack.pop();
  
                      if (!(top instanceof Paren.L<?>)) {
                          output.offer(top);
                      }
  
                  } while (!(top instanceof Paren.L<?>));
  
              } else if (tok instanceof Op.Mon<?>) {
                  stack.push(tok);
              } else if (tok instanceof Op.Bin<?>) {
                  // higher precedence
                  while (!stack.isEmpty() && stack.peek() instanceof Op<?>
                          && ((Op<?>)stack.peek()).preceeds((Op<?>)tok)) {
                      output.offer(stack.pop());
                  }
  
                  stack.push(tok);
              } else if (tok instanceof Arg<?>) {
                  output.offer(tok);
              }
          }
  
          // empty out items remaining ni the stack
          while (!stack.isEmpty()) {
              Expression<E> top = stack.pop();
  
              if (top instanceof Paren.L<?> || top instanceof Paren.R<?>) {
                  throw new CompileLogicException("Unbalanced parentheses.");
              }
  
              output.offer(top);
          }
  
          return output;
      }
docs: *
  Converts an infix logic representation into a postfix logic representation.
  @param tokens a list of tokens in infix form.
  @return a list of tokens in postfix (rpn) form.
  @throws CompileLogicException