开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜