token[m++]=ch; //读取下一个字符}else{ syn=17; //: p--; }break; case '<':m=0; token[m++]=ch; ch=input[p++]; //读取下一个字符 if(ch=='>'){ syn=21; //<> token[m++]=ch; //读取下一个字符}else if(ch=='='){ syn=22; //<= token[m++]=ch; //读取下一个字符}else{ syn=20; //<p--; }break; case'>':m=0; token[m++]=ch; //读取下一个字符 ch=input[p++]; if(ch=='='){ syn=24; //>= token[m++]=ch; //读取下一个字符}else{ syn=23; //> p--; }break; case'=':syn=25; token[0]=ch; break; case';':syn=26; token[0]=ch; break; case'(':syn=27; token[0]=ch; break; case')':syn=28; token[0]=ch; break; case'\n': break; default: break; }}void main(){ cout<<"Please input string:"<<endl; cin.getline(input,80); p=0; do{ automata(); //自动机 if(syn==11) cout<<"("<<syn<<","<<sum<<")"<<endl; //常数 else cout<<"("<<syn<<","<<token<<")"<<endl; //符号}while(syn!=0); //# } 运行结果截屏: 【实验结果分析】