My Profile
Active Members
TodayLast 7 Days
more...
Awards & Gifts
Online Exams
Fresher Jobs
Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian
cities including Bangalore, Chennai, Hyderabad, Pune or Kochi
Resources
Find educational articles, blogs, discussion threads and other resources.
Colleges
Find details about any college in India or search for courses.
|
Resources » Articles/Knowledge Sharing » Education »
System software lab cs1207 - Symbol Table
|
#include #include #include #include void main() { char in[50],dig[50],temp[50]; int i=0,j=0,k=0,l=0; clrscr(); printf("Enter the input expression:"); gets(in); printf("\n Keyword \tIdentifier \tConstant \tOperator \tSplChar\t"); while (in[i]!='\0') { if(isalpha(in[i])) { j=0; while((isalpha(in[i]))||(isdigit(in[i]))) { temp[j]=in[i]; i++; j++; } temp[j]='\0'; if(strcmp(temp,"char")==0||strcmp(temp,"int")==0||strcmp(temp,"float")==0||strcmp(temp,"if")==0||strcmp(temp,"else")==0||strcmp(temp,"do")==0||strcmp(temp,"while")==0||strcmp(temp,"for")==0||strcmp(temp,"switch")==0||strcmp(temp,"case")==0) { printf("\n "); for(l=0;l printf("%c",temp[l]); } else { printf("\n\t\t"); for(l=0;l printf("%c",temp[l]); } } else if(isdigit(in[i])) { k=0; while(isdigit(in[i])) { dig[k]=in[i]; i++; k++; } printf("\n\n\t\t\t\t"); for(l=0;l printf("%c",dig[l]); } else if(in[i]=='+'||in[i]=='-'||in[i]=='<'||in[i]=='>'||in[i]=='/'||in[i]=='%'||in[i]=='*'||in[i]=='=') { printf("\n\n\t\t\t\t\t\t %c",in[i]); i++; } else if(in[i]==';'||in[i]==','||in[i]==':'||in[i]=='.'||in[i]=='('||in[i]==')'||in[i]=='{'||in[i]=='}') { printf("\n\n\t\t\t\t\t\t\t\t %c",in[i]); i++; } else { i++; printf("\n"); } getch(); } }
|
Responses
|
No responses found. Be the first to respond and make money from revenue sharing program.
|
|
Advertise Here
|