资源简介
不知道怎么一次性上传两个文件 lex代码 在另一个下载地址http://download.csdn.net/detail/leecoding/9534587
下载后修改文件后缀为.y 编译后 运行时需要使用 < 文件名.txt 来导入文件流
(具体的文件流知识可以去搜索,如果不明白)
代码片段和文件信息
%{
#include
#include
#include
#include
%}
%token IDENTIFIER NUM CONST VAR PROCEDURE B END ODD IF THEN CALL WHILE DO READ WRITE EQ BE SE
%left ‘+‘ ‘-‘
%left ‘*‘ ‘/‘
%%
program:part_program ‘.‘ {printf(“program -> part_program\n“);}
;
part_program:constant_illstruction var_instruction process_instruction statment{printf(“part_program -> constant_illstruction+var_instruction+process_instruction\n“);}
|constant_illstruction var_instruction statment{printf(“part_program -> constant_illstruction+var_instruction\n“);}
|constant_illstruction statment{printf(“part_program -> constant_illstruction\n“);}
|constant_illstruction process_instruction statment{printf(“part_program -> constant_illstruction+process_instruction\n“);}
|var_instruction process_instruction statment{printf(“part_program -> var_instruction+process_instruction\n“);}
|var_instruction statment{printf(“part_program -> var_instruction\n“);}
|process_instruction statment{printf(“part_program -> process_instruction\n“);}
|statment{printf(“part_program -> statment\n“);}
;
constant_illstruction: CONST const_define ‘;‘ {printf(“constant_illstruction -> const_define\n“);}
|constant_illstruction ‘‘ const_define{printf(“constant_illstruction -> constant_illstruction\n“);}
;
const_define:IDENTIFIER ‘=‘ NUM {printf(“const_define -> IDENTIFIER\n“);}
;
var_instruction:VAR var_mid ‘;‘{printf(“var_instruction -> IDENTIFIER\n“);}
;
var_mid:IDENTIFIER{printf(“var_mid -> IDENTIFIER\n“);}
|IDENTIFIER ‘‘ var_mid{printf(“var_mid -> var_mid \n“);}
;
process_instruction:process_head part_program ‘;‘{printf(“process_instruction -> process_head\n“);}
|process_head part_program ‘;‘ process_instruction ‘;‘ {printf(“process_instruction -> process_head + process_instruction“);}
;
process_head:PROCEDURE IDENTIFIER ‘;‘{printf(“process_head -> PROCEDURE\n“);}
;
statment:assignment {printf(“statment -> assignment\n“);}
|condition {printf(“statment -> condition\n“);}
|circle {printf(“statment -> circle\n“);}
|process_transfer {printf(“statment -> process_transfer\n“);}
|read_statment {printf(“statment -> read_statment\n“);}
|write_statment {printf(“
相关资源
- 编译原理实验工具及参考源码(lex&
- 类pascal语言编译器(编译原理实验)
- 编译原理课程设计:词法语法编译器
- 中科院 编译原理 习题及解答
- 编译原理四元式和逆波兰式
- 《编译原理》清华大学版中的pl0扩充
- PL/0功能扩充break功能
- 编译原理LR(0)语法分析
- 编译原理中间代码生成程序
- 编译原理:LR分析程序
- 操作系统教程课后答案华中科技大学
- 编译原理实验:词法分析,语法分析
- 吉林大学编译原理课件
- 编译原理龙书答案
- 编译原理 第三章课后习题答案
- 易语言变量和数组的编译原理
- 编译原理语法分析器、词法分析器
- 山东大学编译原理PL/0语言 compiler实验
- 华中科技大学算法实验
- FOR循环语句的翻译程序设计简单优先
- NFA的确定化NFA->DFA完整可运行代码
- 华中科技大学824信号与系统资料.zip
- 哈工大威海编译原理实验报告和源代
- 哈工大威海-编译原理实验报告和源码
- 编译原理课设c编译器
- 赋值语句翻译四元式
- 河北工业大学编译原理实验代码及实
- 编译原理课程设计 while do循环语句翻
- 编译原理课程设计do——while简单优先
- 南开大学编译原理课件及作业
评论
共有 条评论