I can not go online through my computer, but can go to net through this laptop. So you see, I can just type in english. What you thought is also mines. But you must think a little more.
The principle is right. The simplest expression is nothing, then result = 0; or when the expression is just a number, then result = this number or when the expression is "a op b" then result = "a op b"
now something more, an expression can an simple one like mentioned above, it can also be very complate, such like a op b op c op d ... or (a op b) op c op (d op e) ...
and here op is one of '+', '-', '*', '/'. when op = '+' then your idea is ok. why? because a + b op c = a + b op c you see the problem is changed to calculate b op c and then a + result from b op c. This is a recussive method. But you must pay attention, when a * b op c you must first do a * b then the result from a * b work continue with c. And what is a - b op c op d ? This situation is more complicated. for example 2 - 3 - 4 + 5 , can you do first 3 - 4 + 5 then 2 - the result from 3 - 4 +5 ? No, you can not do this. and other example 2 - 3 * 4 - 5 can you do first 3 * 4 - 5 then 2 - the result from 3 * 4 - 5 ? No, you can not do this. and even -1 + 1 what will you do?
so you see the minus sign is a problem. What I have done is follows:
a - b + c op d = Expression(( Expression(a-b).doCalculation() -> string + c op d).doCalculation() a - b * c op d = Expression(a - (Expression(b*c).doCalculation() ->string) op d).doCalculation()