....

Also, what I think (only guess) :

there are two stacks :

1 - stack of arguments (let call it : SA)

2 - stack of operators (let call it : SO).

We always push on stack.

We pop from stack, only at end of formula, or when we reach an operator at

the same priority or less then current priority.

The 1st 2nd arguments are operated by the 1st argument.

When pop from stack - we pop from the last argument of the stack (LIFO).

9+3+4*5-2

SA:9

SO:<empty>

SA:9

SO:+

SA:9,3

SO:+

(there is no another operand, so we keep pushing on stack).

SA:9,3

SO:+,+

(now we can pop the lasts : 9,3 with +, and push the result again into

stack)

SA:12

So:+

SA:12,4

SO:+

(there is no next argument, so we're keep trying).

SA:12,4

SO:+,*

SA:12,4,5

SO:+,*

SA:12,4,5,

SO:+,*,-

(now the priority is downed so we pop the last arguments : 4,5, with

corresponding operator : *, and push back to stack).

SA:12,20

SO:+,-

SA:32

SO:-

SA:32,2

SO:-

<end>

SA:30

SO:<empty>

Stack is empty, so we pop the result on argument : SA.

result = 30 !

The same thing can be for brakes "(" with a higher priority no. (I can mark

for each element it's priority, by some kind of method :

when priority get higher, I increment the priority counter, when it getting

lower I decrement the priority counter, and every time, and due that I know

how can I handle the stack as I have described above.

Is the above right thorey ?

If the above is right, I think I'll mange...

Thanks