文件名称:postfix-notation
-
所属分类:
- 标签属性:
- 上传时间:2015-10-29
-
文件大小:1.3kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
1、给出文法如下:
G[E]
E->T|E+T
T->F|T*F
F->i(E)
对应的转化为逆波兰式的语义动作如下:
E-> E(1)op E(2) {E.CODE:= E(1).CODE||E(2).CODE||op}
E->(E(1)) { E.CODE := E(1).CODE}
E->id { E.CODE := id}
2、利用实验5中的算符优先分析算法,结合上面给出的语义动作实现逆波兰式的构造;
3、利用栈,计算生成的逆波兰式,步骤如下:
1)中缀表达式,从文本文件读入,每一行存放一个表达式,为了降低难度,表达式采用常数表达式;
2)利用结合语法制导翻译的算符优先分析,构造逆波兰式;
3)利用栈计算出后缀式的结果,并输出;-1 gives grammar as follows: E [E] E-> T | E+ T T-> F | T* F F-> i (E) the corresponding inverse Polish into semantic action as follows:
E-> E (1) op E (2) {E.CODE: = E (1) .CODE || E (2) .CODE || op}
E-> (E (1)) {E.CODE: = E (1) .CODE}
E-> id {E.CODE: = id}
2, the use of experimental 5 operator priority analysis algorithms, combined with semantic actions given above structure to achieve reverse Polish notation
3, the use of the stack, calculates the resulting Reverse Polish Notation, as follows:
1) infix expression, read a text file, each line deposited an expression, in order to reduce the difficulty of using a constant expression expression
2) the use of binding syntax directed translation of operator priority analysis, structural inverse Polish
3) Using the calculated postfix stack of results and outputs
G[E]
E->T|E+T
T->F|T*F
F->i(E)
对应的转化为逆波兰式的语义动作如下:
E-> E(1)op E(2) {E.CODE:= E(1).CODE||E(2).CODE||op}
E->(E(1)) { E.CODE := E(1).CODE}
E->id { E.CODE := id}
2、利用实验5中的算符优先分析算法,结合上面给出的语义动作实现逆波兰式的构造;
3、利用栈,计算生成的逆波兰式,步骤如下:
1)中缀表达式,从文本文件读入,每一行存放一个表达式,为了降低难度,表达式采用常数表达式;
2)利用结合语法制导翻译的算符优先分析,构造逆波兰式;
3)利用栈计算出后缀式的结果,并输出;-1 gives grammar as follows: E [E] E-> T | E+ T T-> F | T* F F-> i (E) the corresponding inverse Polish into semantic action as follows:
E-> E (1) op E (2) {E.CODE: = E (1) .CODE || E (2) .CODE || op}
E-> (E (1)) {E.CODE: = E (1) .CODE}
E-> id {E.CODE: = id}
2, the use of experimental 5 operator priority analysis algorithms, combined with semantic actions given above structure to achieve reverse Polish notation
3, the use of the stack, calculates the resulting Reverse Polish Notation, as follows:
1) infix expression, read a text file, each line deposited an expression, in order to reduce the difficulty of using a constant expression expression
2) the use of binding syntax directed translation of operator priority analysis, structural inverse Polish
3) Using the calculated postfix stack of results and outputs
(系统自动生成,下载前可以参看下载内容)
下载文件列表
postfix notation.cpp
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.