2、nt=0,error;//记录结果集的条数intsyn,p,sum,kk,m,n,row,k,len.doubledsum,sop;charindex[800];//记录指数形式的浮点数charr[6][10]={"function","if","then","white","do","endfunc"};charmaxntoken[],d[maxn];charch;boolis_letter(charc){returnc>='a'&&c<=z's
3、
4、c>='a'&&c<=z;}boolis_digtial(charc){returnc>=0&&c<=9);}boolis_dot(char
5、c){returnc==,
6、
7、c==';';}voididentifier()//标示符的判断{m=0;while(n>=a&w<=z's
8、
9、ch>=0&&ch<=9){token[m++]=ch;ch=d[++p);}token[m]=' '.ch=s[p].syn=10;forn=0;n<6;n++)if(strcmp(token,r[n])==0){syn=n+1;break;}}voiddigit(boolpositive)//数字的判断{len=sum=0;ch=s[p].while(n>=0&&ch<=9){sum=sum+10+ch-0.ch=d[++p);}if(n==.
10、){dsum=sum;syn=12;ch=d[++p);pos=0.1;while(n>=0&&ch<=9){dsum=dsum+(ch-0)*pos;pos=pos*0.1;ch=d[++p);}if(n==thatis){index(len++]=ch;ch=d[++p);if(ch=='-'
11、
12、ch=='+'){index(len++]=ch;ch=d[++p);}if(!(ch>=0&&ch<=9)){//cout<<"looooooooooook"<=0&&ch<=9){index(len++]=ch;ch=d[++p);}}
13、}if(syn==-1
14、
15、(ch>='&&ch<=z)
16、
17、ch==.){syn=1;//对数字开头的标识符进行判错.while(n>=0&&ch<=9
18、
19、ch>='a'&&ch<=zisch==
20、
21、.)ch=d[++p);//找到下一次要判断的开头ch=s[p].}else{ch=s[p].syn=12;if(!positive)dsum*=-1.0.}}else{if(ch>='&&ch<=z){syn=1;//对数字开头的标识符进行判错.while(n>=0&&ch<=9
22、
23、ch>='a'&&ch<=z)ch=d[++p);//找到下一次要判断的开头ch=s[p].}else{ch=s
24、[p].syn=11.if(!positive)sum*=-1.}}}voidto_double(){inti;printf("(%d%lf,syn,dsum);if(len){for(i=0;i=0”&的[我]<=9)返回true;如果(i)!=[和]!=“t”和“s”!=“n”返回false;++;}返回false;}布尔check_pre_prog(){inti=p-1;当
25、(=0){如果(i)!=[和]!=“t”和“s”!=“n”{如果(的[我]>=0”&的[我]<=9
26、
27、的[我]>=A&S[我]<=Z)返回false;否则返回true;}我--;}返回true;}无效pot(){(1){CH=;如果(==“n”)行+;如果(!(CH==”
28、
29、CH=='t'
30、
31、CH==''))打破;}}无效scaner(){memset(令牌,0,sizeof(令牌));pot();如果(is_le