全文预览

编译原理-太原理工大学

上传者:qnrdwb |  格式:doc  |  页数:12 |  大小:332KB

文档介绍
) == '(') { Р System.out.println("\n您输入的中缀表达式中有无法配对的'('括号,请仔细核实!");Р System.exit(0);Р } else {Р Reverse_Polish_Expression += Analysis_StackР .charAt(Analysis_Stack.length() - 1);Р Analysis_Stack = Analysis_Stack.substring(0,Р Analysis_Stack.length() - 1);Р }Р }Р // 退栈输出Р System.out.println("逆波兰式为:"Р + Reverse_Polish_Expression);Р System.exit(0);Р } else {Р if (Operator_Judgement(Infix_Expression[count]) == -1) {Р Reverse_Polish_Expression += Infix_Expression[count];Р } else {Р while (Analysis_Stack.length() != 0) { // 检测分析栈Р if (Operator_Precedence_Relation_Matrix[Operator_Judgement(Analysis_StackР .charAt(Analysis_Stack.length() - 1))][Operator_Judgement(Infix_Expression[count])] == '<') {Р Analysis_Stack += Infix_Expression[count];Р break;Р } else {Р if (Infix_Expression[count] != ')') {

收藏

分享

举报
下载此文档