- 7
- 0
- 约2.41万字
- 约 22页
- 2016-10-15 发布于贵州
- 举报
C语言词法分析 源代码 风君版
C语言词法分析器 源代码 风君版.txt婚姻是键盘,太多秩序和规则;爱情是鼠标,一点就通。男人自比主机,内存最重要;女人好似显示器,一切都看得出来。#include stdio.h
#include string.h
#include stdlib.h
char *key0[]={ ,auto,break,case,char,const,continue,default,do,double,else,enum,extern,float,for,goto,if,int,long,register,return,short,signed,sizeof,static,struct,switch,typedef,_Complex,_Imaginary,union,unsigned,void,volatile,while};
/*保留字表*/
char *key1[]={ ,(,),[,],{,},,,;,};
/*分隔符表*/
char *key2[]={ ,+,-,*,/,%,,,==,=,=,!=,!,,||,,,~,|,^,,=,?:,-,++,--,.,+=,-=,*=,/=};
/*运算符表*/
int xx0[35],xx1[10],xx2[31];
int temp_key3=0,temp_c40=0,temp_c41=0,temp_c42=0,temp_c43=0;
/******* 初始化函数 *******/
void load()
{
int mm;
for (mm=0;mm=34;mm++)
{
xx0[mm]=0;
}
for (mm=0;mm=9;mm++)
{
xx1[mm]=0;
}
for (mm=0;mm=30;mm++)
{
xx2[mm]=0;
}
FILE *floading;
if ((floading=fopen(key0.txt,w))==NULL)
{
printf(Error! Cant create file : key0.txt);
return;
}
fclose (floading);
/*建立保留字表文件:key0.txt*/
if ((floading=fopen(key1.txt,w))==NULL)
{
printf(Error! Cant create file : key1.txt);
return;
}
/*建立分隔符表文件:key1.txt*/
if ((floading=fopen(key2.txt,w))==NULL)
{
printf(Error! Cant create file : key2.txt);
return;
}
fclose(floading);
/*建立运算符表文件:key2.txt*/
if ((floading=fopen(key3.txt,w))==NULL)
{
printf(Error! Cant create file : key3.txt);
return;
}
fclose (floading);
/*建立标识符表文件:key3.txt*/
if ((floading=fopen(c40.txt,w))==NULL)
{
printf(Error! Cant create file : c40.txt);
return;
}
fclose (floading);
/*建立整数类型常量表文件:c40.txt*/
if ((floading=fopen(c41.txt,w))==NULL)
{
printf(Error! Cant create file : c41.txt);
return;
}
fclose (floading);
/*建立浮点类型常量表文件:c41.txt*/
if ((floading=fopen(c42.txt,w))==NULL)
{
printf(Error! Cant create file : c42.txt);
return;
}
fclose (floading);
/*建立字符类型常量表文件:c42.txt*/
if ((floading=fopen(c43.txt,w))==NULL)
{
printf(Error! Cant create file : c43.txt);
return;
}
fclose (floading);
/*建立字符串类型常量表文件:c43.txt*/
if ((floading=fopen(defination.txt,w))==NULL)
{
您可能关注的文档
最近下载
- 税务师-税法一-突击强化题-第4章城市维护建设税、教育费附加及地方教育附加.docx VIP
- 航空发动机维修(MRO)市场现状调研报告_2025年12月.docx VIP
- 粉笔-市场前景及投资研究报告-线上公考,OMO多元化发展路径.pdf
- Invitrogen Qubit荧光计Qubit 4和Qubit Flex说明书.pdf
- 油水分离器采购及安装合同模板.docx VIP
- 2025-2030年中国城轨建设行业深度发展研究及“十五五”发展规划与趋势预测研究报告.docx
- 云米Link说明书用户手册.pdf
- 银河麒麟服务器虚拟化系统V10 彩页.pdf VIP
- 好的教育读书分享 课件(共18张PPT).pptx VIP
- 申论真题及答案重庆2025.doc VIP
原创力文档

文档评论(0)