52ky 发表于 2022-9-25 21:45:29

逆波兰式生成程序

通过运算优先级联系矩阵对输入的表达式生产逆波兰式。逆波兰表达式生成算法的关键在于比较当时运算符与栈顶运算符的优先联系,若当时运算符的优先级高于栈顶运算符,则当时运算符入栈,若当时运算符的优先级低于栈顶运算符,则栈顶运算符退栈。
说明.doc

(Produces the inverse Polish formula for the input expression by operating on the priority relation matrix. The key of the reverse Polish expression generation algorithm is to compare the precedence relationship between the current operator and the stack top operator. If the current operator's priority is higher than the stack top operator, the current operator is pushed onto the stack. If the current operator's priority is higher than the stack top operator Below the top-of-stack operator, the top-of-stack operator pops off the stack.
Description.doc)




页: [1]
查看完整版本: 逆波兰式生成程序