摘要
表达式求值是程序设计语言编译中的一个最基本问题。与人们习惯的中缀表示的表达式相比,后缀表达式不存在括号,没有优先级的差别,表达式中各个运算是按照运算符出现的顺序进行的。因此非常适合串行工作的计算机处理方式。该文首先对这两种表达式表示方法进行了分析比较,然后通过具体分析实现这两种表达式求值的算法来论证表达式后缀表示优于中缀表示。最后简要谈一下中缀表达式到后缀表达式的转换。
The expression evaluation is the most basic question in programming language translation. Compared with infix expression with which people are familiar, suffix expression does not have the parenthesis, nor does it have the priority difference; each operation is carried out according to the order in which the operator appears. Therefore it is suitable for the serial work of the computer processing mode. This article first analyses and compares these two kinds of expression, then attempts to prove that suffix expression is superior to infix expression through the concrete analysis of the realization of evaluation algorithm of these two kinds of expression. Finally it discusses briefly the transformation of infix expression into the suffix expression.
出处
《电脑知识与技术(过刊)》
2009年第11X期8921-8923,共3页
Computer Knowledge and Technology
关键词
中缀表达式
后缀表达式
算符优先
堆栈
infix expression
suffix expression
priority operator
stack