int notexist(char tok[]) { int i; for(i=0;i<k;i++) { if(strcmp(s[i].name,tok)==0) return 0; } return 1; }
void delete(char word[]) { int i=0,j,exist=notexist(word); if(exist==1) printf("symbol not present!\n"); else { for(i=0;i<k;i++) { if(strcmp(s[i].name,word)==0) { for(j=i;j<k-1;j++) s[j]=s[j+1]; k--; for(j=1;j<k;j++) s[j].address=s[j-1].address+s[j-1].size; break; } }
} }
void modify(char word[]) { int i=0,exist=notexist(word); char val[20],a[100]; if(exist==1) printf("symbol not present!\n"); else { printf("enter new value:"); scanf("%s",a); for(i=0;i<k;i++) { if(strcmp(s[i].name,word)==0) { strcpy(s[i].value,a); break; } } }
}
void create(char word[]) { char tokens[20][20]={"int","float","char","double"}; char *tok,t[100],tem[30],*temp,*point,col[10],row[10],buff[100]; int array=0,gg=0,r,c,cc=0,g=0,z=0,i=0,flag=0,l=0,f=0,d=0; strcpy(tem,word); tok=strtok(word," ,+=;()-%[]}{\n"); while(tok!=NULL) { array=0; for(l=0;l<4;l++) { if(strcmp(tok,tokens[l])==0)// checking for int/float/char/const
{ flag=1; switch(l) { case 0: i++; break; case 1: f++; break; case 2: cc++; break; case 3: d++; break; } goto next; } } if(flag==1) { int exist=notexist(tok); if(exist!=0) {
if(i==1) { i--; strcpy(s[k].name,tok); strcpy(s[k].type,"int"); g=0; if(tem[strlen(tok)+4]=='[') { array=1; for(z=strlen(tok)+5;tem[z]!=']';z++) row[g++]=tem[z]; row[g]='\0'; r=atoi(row); g=0; if(tem[z+1]=='[')
{ array=2; z+=2; while(tem[z]!=']') col[g++]=tem[z++]; col[g]='\0'; c=atoi(col);
} else c=1; s[k].size=r*c*2; } else s[k].size=2;
if(k!=0) s[k].address=s[k-1].address+s[k-1].size; if(array==1||array==2) { g=0; if(tem[z+1]=='=') { z+=2; while(tem[z-1]!='}') buff[g++]=tem[z++]; buff[g]='\0'; strcpy(s[k].value,buff); } else strcpy(s[k].value,"-"); }
else { tok=strtok(NULL," ,+[]=;()}{\n"); if(isdigit(tok[0]))