The first thing you'd need is to make a token separator, which will give you a string array of everything So sin(-5.8-7) would return sin, (, -5.8, -, 7, ) Then go to the RPM wiki page, and create the program from the pseudocode It would convert it to -5.8, 7, -, sin Which means you read it from left to right, pushing and popping them from a stack till u have 1 item left (the answer)