How do calculator parse expressions
How do digital calculators convert the expression for parsing? Is it infix, prefix, or postfix? How do calculators solve expres开发者_如何学编程sions?
Nowadays it is most common to enter single line expressions in digital calculators just as you would write them down, so normally infix notation. Converting to postfix is a common way to evaluate those expressions in order to solve them.
There are lots of examples around, this C++ implementation has lots of implementation information and also briefly explains handling parentheses, left associative vs. right associative operators and stuff like that.
精彩评论