convert an expression to reverse Polish notation