online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
/****************************************************************************** 4. Design, develop and implement YACC/C program to demonstrate Shift Reduce Parsing technique for the grammar rules: E →E+T | T, T →T*F | F, F → (E) | id and parse the sentence: id + id * id #Author:Madhusudana Reddy G R , M S Engineering College Bangalore. *******************************************************************************/ #include<stdio.h> #include<conio.h> #include<string.h> int k=0,z=0,i=0,j=0,c=0; char a[16],ac[20],stk[15],act[10]; void check(); void main() { puts("GRAMMAR is E->E+E \n E->E*E \n E->(E) \n E->id"); puts("enter input string "); gets(a); c=strlen(a); strcpy(act,"SHIFT->"); puts("stack \t input \t action"); for(k=0,i=0; j<c; k++,i++,j++) { if(a[j]=='i' && a[j+1]=='d') { stk[i]=a[j]; stk[i+1]=a[j+1]; stk[i+2]='\0'; a[j]=' '; a[j+1]=' '; printf("\n$%s\t%s$\t%sid",stk,a,act); check(); } else { stk[i]=a[j]; stk[i+1]='\0'; a[j]=' '; printf("\n$%s\t%s$\t%ssymbols",stk,a,act); check(); } } getch(); } void check() { strcpy(ac,"REDUCE TO E"); for(z=0; z<c; z++) if(stk[z]=='i' && stk[z+1]=='d') { stk[z]='E'; stk[z+1]='\0'; printf("\n$%s\t%s$\t%s",stk,a,ac); j++; } for(z=0; z<c; z++) if(stk[z]=='E' && stk[z+1]=='+' && stk[z+2]=='E') { stk[z]='E'; stk[z+1]='\0'; stk[z+2]='\0'; printf("\n$%s\t%s$\t%s",stk,a,ac); i=i-2; } for(z=0; z<c; z++) if(stk[z]=='E' && stk[z+1]=='*' && stk[z+2]=='E') { stk[z]='E'; stk[z+1]='\0'; stk[z+1]='\0'; printf("\n$%s\t%s$\t%s",stk,a,ac); i=i-2; } for(z=0; z<c; z++) if(stk[z]=='(' && stk[z+1]=='E' && stk[z+2]==')') { stk[z]='E'; stk[z+1]='\0'; stk[z+1]='\0'; printf("\n$%s\t%s$\t%s",stk,a,ac); i=i-2; } }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue