1 #include<stdio.h> 2 #include<stdlib.h> 3 #include <string.h> 4 char *rword[]={"dir","cd","md","rd","cls","date","time","ren","copy","exit","end"}; 5 char ci; 6 typedef struct{ 7 int num; 8 char *word; 9 }WORD; //存储种别码,单词 10 11 typedef struct{ 12 int number; 13 char means[5000]; 14 }Base; //存储种别码,单词 15 16 int ainput,toke; char input[300];char token[300]=" "; 17 Base mean[10]; 18 19 char mgetch(){ //读取一个字符 20 ci=input[ainput]; 21 ainput=ainput+1; 22 return (ci); 23 } 24 25 void getbc(){ //去空格 26 while(ci==' '||ci==10) 27 { ci=input[ainput]; 28 ainput+=1; 29 30 } 31 } 32 int letter() //判断是否为字母 33 { if(ci>='a'&&ci<='z'||ci>='A'&&ci<='Z') 34 return 1; 35 else 36 return 0; 37 } 38 int number() //判断是否为数字 39 { 40 if(ci>='0'&&ci<='9') 41 return 1; 42 else 43 return 0; 44 } 45 int reserve() // 判断是否为关键字 46 { 47 int i=0; 48 while(strcmp(rword[i],"end")) 49 { 50 if(!strcmp(rword[i],token)) 51 { 52 return i+1; 53 } 54 i++; 55 } 56 57 return 1001; 58 59 } 60 61 void link() //链接单词 62 { 63 token[toke]=ci; 64 toke+=1; 65 token[toke]='