C语言词法研究器 源代码 风君版.docVIP

  • 4
  • 0
  • 约1.84万字
  • 约 22页
  • 2018-11-21 发布于江苏
  • 举报
C语言词法研究器 源代码 风君版

#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) { printf(Error! Cant create file : defination.txt); return; } fclose (floading)

文档评论(0)

1亿VIP精品文档

相关文档