文件名称:lab2
- 所属分类:
- 编译器/词法分析
- 资源属性:
- [Windows] [Visual C] [源码]
- 上传时间:
- 2012-12-15
- 文件大小:
- 307kb
- 下载次数:
- 0次
- 提 供 者:
- liang*****
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
实验二:TINY扩充语言的语法分析
扩充的语法规则有:实现 while、do while、for语句和求余计算式子,具体文法规则自行构造。
可参考:P97及P136的文法规则。
(1) While-stmt --> while exp do stmt-sequence endwhile
(2) Dowhile-stmt-->do stmt-sequence while exp
(3) for-stmt-->for identifier:=simple-exp to simple-exp do stmt-sequence enddo 步长递增1
(4) for-stmt-->for identifier:=simple-exp downto simple-exp do stmt-sequence enddo 步长递减1
可由用户选择是否生成语法树,并可查看所生成的语法树。-Experiment II: TINY extension language syntax analysis of the expansion of grammar rules: to achieve the while, do while, for statement and the remainder calculation formulas, specific grammar rules to construct their own. Reference: P97 and P136 grammar rules. (1) While-stmt-> while exp do stmt-sequence endwhile (2) Dowhile-stmt-> do stmt-sequence while exp (3) for-stmt-> for identifier: = simple-exp to simple- exp do stmt-sequence enddo increments of 1 (4) for-stmt-> for identifier: = simple-exp downto simple-exp do stmt-sequence enddo variety step decrement by the user to choose whether to generate a syntax tree, and view generated syntax tree.
扩充的语法规则有:实现 while、do while、for语句和求余计算式子,具体文法规则自行构造。
可参考:P97及P136的文法规则。
(1) While-stmt --> while exp do stmt-sequence endwhile
(2) Dowhile-stmt-->do stmt-sequence while exp
(3) for-stmt-->for identifier:=simple-exp to simple-exp do stmt-sequence enddo 步长递增1
(4) for-stmt-->for identifier:=simple-exp downto simple-exp do stmt-sequence enddo 步长递减1
可由用户选择是否生成语法树,并可查看所生成的语法树。-Experiment II: TINY extension language syntax analysis of the expansion of grammar rules: to achieve the while, do while, for statement and the remainder calculation formulas, specific grammar rules to construct their own. Reference: P97 and P136 grammar rules. (1) While-stmt-> while exp do stmt-sequence endwhile (2) Dowhile-stmt-> do stmt-sequence while exp (3) for-stmt-> for identifier: = simple-exp to simple- exp do stmt-sequence enddo increments of 1 (4) for-stmt-> for identifier: = simple-exp downto simple-exp do stmt-sequence enddo variety step decrement by the user to choose whether to generate a syntax tree, and view generated syntax tree.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
lab2\analyze.c
....\analyze.h
....\cgen.c
....\cgen.h
....\code.c
....\code.h
....\Debug\analyze.obj
....\.....\analyze.sbr
....\.....\cgen.obj
....\.....\cgen.sbr
....\.....\code.obj
....\.....\code.sbr
....\.....\lab2.bsc
....\.....\lab2.exe
....\.....\lab2.ilk
....\.....\lab2.pch
....\.....\lab2.pdb
....\.....\main.obj
....\.....\main.sbr
....\.....\parse.obj
....\.....\parse.sbr
....\.....\r.tm
....\.....\r.tny
....\.....\sample.tny
....\.....\scan.obj
....\.....\scan.sbr
....\.....\symtab.obj
....\.....\symtab.sbr
....\.....\util.obj
....\.....\util.sbr
....\.....\vc60.idb
....\.....\vc60.pdb
....\globals.h
....\lab2.dsp
....\lab2.dsw
....\lab2.ncb
....\lab2.opt
....\lab2.plg
....\main.c
....\parse.c
....\parse.cpp
....\parse.h
....\sample.tm
....\sample.tny
....\scan.c
....\scan.h
....\symtab.c
....\symtab.h
....\util.c
....\util.h
....\Debug
lab2