#include <stdio.h> #include <string.h> char prog[80], token[8]; char ch; int syn, p, m, n, sum, kk=0; char *rwtab[6]={"begin", "if", "then", "while", "do", "end"}; void scaner(); void E(); void Y(); void T(); void B(); void C(); void A(); void main() { p=0; printf("Please input string: "); do { scanf("%c", &ch); prog[p++]=ch; }while(ch!='#'); //当遇到‘#’,结束输入 p=0; scaner(); E(); } void scaner() { for(n=0; n<8; n++) token[n]=NULL; ch=prog[p++]; while(ch==' '||ch==' ') ch=prog[p++]; m=0; if((ch>='A'&&ch<='Z') || (ch>='a'&&ch<='z')) { while((ch>='A'&&ch<='Z') || (ch>='a'&&ch<='z')||(ch>='0'&&ch<='9')) { token[m++]=ch; ch=prog[p++]; // 将prog数组的字母复制到ch数组中 } token[m++]='