资源简介
东北大学编译原理课程设计,采用C语言,数据结构主要是链表和指针数组,有完善的token,函数表,四元式,单寄存器后端(无优化)。
代码片段和文件信息
#include “list.h“
struct character chara;
struct str strin;
struct constant cons;
struct identifier identi;
struct Token token;
struct cengci myceng;
struct func_all myallfunc;
siyuanshi si1;
SEM mysem1;
backend bkd;
struct Token* temp_p = &token;
struct cengci* myceng_temp = &myceng;
struct func_all* allfunc = &myallfunc;
char shuju_type[4][8] = { “void““int““float““char“ };
char type[2][10] = { “变量““函数“ };
int line[100];
int scan_flag = 0;
int line_number = 0;
int token_flag = 1;
int h=1abcd=0;
extern ifnum[5];
extern wnum[5];
extern elsenum[5];
extern wend[5];
int main()
{
initcharac(&chara);
initstr(&strin);
initconstant(&cons);
initiden(&identi);
inittoken(&token);
init_siyuanshi(&si1);
init_SEM(&mysem1);
init_cengci(&myceng);
initallfunc(&myallfunc);
FILE* fp;
char ch;
fp = fopen(“test.txt“ “r“);
while ((ch = getc(fp)) != EOF)
{
if (ch == ‘ ‘ || ch == ‘\t‘ || ch == ‘\n‘)
{
if (ch == ‘\n‘)
{
line[line_number] = scan_flag;
line_number++;
}
}
else
{
fseek(fp -1L SEEK_CUR);
if (!scan(fp &chara &strin &cons &identi &token))
break;
else
scan_flag++;
}
}
int temp;
char c_temp = ‘(‘;
struct character* temp4;
struct str* temp5;
struct constant* temp3;
struct identifier* temp1;
struct Token* temp2 * token_fuhao * token_hanshu;
temp1 = &identi;
token_hanshu = token_fuhao = temp2 = &token;
temp3 = &cons;
temp4 = &chara;
temp5 = &strin;
temp = 1;
printf(“*************************************************************************************\n“);
printf(“character:\n“);
if (temp4->cha == NULL)
printf(“NO DATE!\n“);
else
{
printf(“%d\t%s\n“ temp temp4->cha);
while (temp4->next != NULL)
{
temp4 = temp4->next;
temp++;
printf(“%d\t%s\n“ temp temp4->cha);
}
}
temp = 1;
printf(“*************************************************************************************\n“);
printf(“string:\n“);
if (temp5->st == NULL)
printf(“NO DATE!\n“);
else
{
printf(“%d\t%s\n“ temp temp5->st);
while (temp5->next != NULL)
{
temp5 = temp5->next;
temp++;
printf(“%d\t%s\n“ temp temp5->st);
}
}
temp = 1;
printf(“*************************************************************************************\n“);
printf(“constant:\n“);
if (temp3->con < 0)
printf(“NO DATE!\n“);
else
{
printf(“%d\t%f\n“ temp temp3->con);
while (temp3->next != NULL)
{
temp3 = temp3->next;
temp++;
printf(“%d\t%f\n“ temp temp3->con);
}
}
printf(“*************************************************************************************\n“);
temp = 1;
printf(“identifier:\n“);
if (temp1->iden == NULL)
printf(“NO DATE!\n“);
else
{
printf(“%d\t%s\n“ temp temp1->iden);
while (temp1->next != NULL)
{
temp1 = temp1->next;
temp++;
printf(“%d\t%s\n“ temp temp1->iden);
}
}
printf(“*
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-12-22 14:27 编译课设\
文件 1237 2019-12-19 16:14 编译课设\asfas.cbp
文件 975 2019-12-20 21:03 编译课设\asfas.depend
文件 905 2019-12-22 14:27 编译课设\asfas.layout
目录 0 2019-12-20 17:52 编译课设\bin\
目录 0 2019-12-20 17:52 编译课设\bin\Debug\
文件 74320 2019-12-19 20:14 编译课设\bin\Debug\asfas.exe
文件 4651 2019-12-19 17:10 编译课设\list.h
文件 8490 2019-12-19 15:54 编译课设\main.c
目录 0 2019-12-20 17:52 编译课设\obj\
目录 0 2019-12-20 17:52 编译课设\obj\Debug\
文件 12820 2019-12-19 17:13 编译课设\obj\Debug\main.o
文件 39125 2019-12-19 17:13 编译课设\obj\Debug\parser.o
文件 12867 2019-12-19 20:14 编译课设\obj\Debug\token.o
文件 41223 2019-12-19 17:08 编译课设\parser.c
文件 153 2019-12-19 20:38 编译课设\test.txt
文件 10906 2019-12-19 20:14 编译课设\token.c
- 上一篇:这是用C语言实现模糊控制的算法程序
- 下一篇:数据结构列车时刻表管理系统
相关资源
- 这是用C语言实现模糊控制的算法程序
- 滴水逆向 文件操作pe修改C语言源代码
- C语言:中缀算术表达式求值栈 附答案
- 用C语言实现DPSK数字信号调制
- 单片机电子琴设计用C语言编写
- 基于Linux消息队列的简易聊天室(C语
- C语言高级编程技术 很好的一本书
- C语言矩阵相乘动态数组,文件读写
- 步进伺服电机加减速控制C语言
- 模拟文件系统的c语言实现
- (严蔚敏)数据结构视频教程C语言版
- c语言车票管理系统
- C 经典100例 C语言的经典小程序,100个
- 编写C语言程序,模拟UNIX磁盘空间管理
- 基于C语言实现的网络爬虫
- 国密SM4的5中模式C语言实现,vs工程,
- C语言数据结构程序表达式求值 二叉树
- C语言练习指针及答案
- 北理乐学 C语言 编程题源代码
- 基于linux下的图像缩小 c语言
- 校园导航系统C语言版
- C语言 Huffman编码
- 灭火机器人
- 《C语言课程设计》 学生成绩管理系统
- FLICM聚类算法C语言
- C语言历年试题及答案合集
- C语言读取BMP文件
- 离散数学实验 C语言编程
- 宿舍管理系统 数据结构课程设计 宿舍
- 奇异值分解SVD算法c语言源代码
评论
共有 条评论