fork download
  1. #include<stdio.h>
  2. #include<ctype.h>
  3.  
  4. int main(){
  5. char prod[50];
  6.  
  7. printf("Enter production (E->E+T): ");
  8. scanf("%s",prod);
  9.  
  10. if(isupper(prod[0]) && prod[1]=='-' && prod[2]=='>')
  11. printf("Grammar is Context Free\n");
  12. else
  13. printf("Not a Context Free Grammar\n");
  14.  
  15. return 0;
  16. }
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
Enter production (E->E+T): Not a Context Free Grammar