previous | index | next

Evaluating Expressions According to Precedence Rules

Approach: Scan from left to right, remembering the symbols seen, called tokens:

3 + 2 * 4 40 / 5

3 + 2 cannot be evaluated because + has lower precedence than *.

So continue scanning.


previous | index | next