#include <stdio.h> #include <string.h> #define max 100 char a[max],b[8],ch; int syn,p,m,n,sum; char word[][6]={"begin","if","then","while","do","end"}; void mor() { sum=0; ch=a[p++]; m=0; while((ch==' ')||(ch==' ')||(ch==' ')) ch=a[p++]; if(((ch<='z')&&(ch>='a'))||((ch<='Z')&&(ch>='A'))) { while(((ch<='z')&&(ch>='a'))||((ch<='Z')&&(ch>='A'))||((ch>='0')&&(ch<='9'))) { b[m++]=ch; ch=a[p++]; } p--; syn=10; for(n=0;n<6;n++) if(strcmp(b,word[n])==0) { syn=n+1; break; } } else if((ch>='0')&&(ch<='9')) { while((ch>='0')&&(ch<='9')) { sum=sum*10+ch-'0'; ch=a[p++]; } p--; syn=11; } else { switch(ch) { case '+': syn=13; b[m++]=ch; break; case '-': syn=14; b[m++]=ch; break; case '*': syn=15; b[m++]=ch; break; case '/': syn=16; b[m++]=ch; break; case ':': b[m++]=ch; ch=a[p++]; if(ch=='=') { syn=18; b[m++]=ch; } else { syn=18; p--; } break; case '<': b[m++]=ch; ch=a[p++]; if(ch=='=') { syn=21; b[m++]=ch; } else { syn=20; p--; } break; case '>': b[m++]=ch; ch=a[p++]; if(ch=='=') { syn=24; b[m++]=ch; } else { syn=23; p--; } break; case '=': syn=25; b[m++]=ch; break; case ';': syn=26; b[m++]=ch; break; case '(': syn=27; b[m++]=ch; break; case ')': syn=28; b[m++]=ch; break; case '#': syn=0; b[m++]=ch; break; case '!': syn=-2; break; default: syn=-1; break; } } b[m++]='