C语言词法分析 源代码 风君版.docVIP

  • 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) {

文档评论(0)

1亿VIP精品文档

相关文档