non-recursive from/to rpn implementation