开发者

How do calculator parse expressions

开发者 https://www.devze.com 2023-02-25 08:33 出处:网络
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 ex

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

精彩评论

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