curr
to track the current number being built and previousOperator
to track the last operator seen.curr
to include the digit.previousOperator
and push the result onto the stack.(
is encountered, push previousOperator
onto the stack and reset curr
and previousOperator
for the new isolated expression.)
is encountered, pop and sum all terms until an operator is reached, then use this operator to process the result of the isolated expression.