"Write a program to check whether a grammar is left recursive or not, if it is remove left recursion" Code Answer's
You're definitely familiar with the best coding language Whatever that developers use to develop their projects and they get all their queries like "Write a program to check whether a grammar is left recursive or not, if it is remove left recursion" answered properly. Developers are finding an appropriate answer about Write a program to check whether a grammar is left recursive or not, if it is remove left recursion related to the Whatever coding language. By visiting this online portal developers get answers concerning Whatever codes question like Write a program to check whether a grammar is left recursive or not, if it is remove left recursion. Enter your desired code related query in the search bar and get every piece of information about Whatever code related question on Write a program to check whether a grammar is left recursive or not, if it is remove left recursion.
Write a program to check whether a grammar is left recursive or not, if it is remove left recursion
1: #include<stdio.h>
2: #include<string.h>
3: #define SIZE 10
4: int main () {
5: char non_terminal;
6: char beta,alpha;
7: int num;
8: char production[10][SIZE];
9: int index=3; /* starting of the string following "->" */
10: printf("Enter Number of Production : ");
11: scanf("%d",&num);
12: printf("Enter the grammar as E->E-A :\n");
13: for(int i=0;i<num;i++){
14: scanf("%s",production[i]);
15: }
16: for(int i=0;i<num;i++){
17: printf("\nGRAMMAR : : : %s",production[i]);
18: non_terminal=production[i][0];
19: if(non_terminal==production[i][index]) {
20: alpha=production[i][index+1];
21: printf(" is left recursive.\n");
22: while(production[i][index]!=0 && production[i][index]!='|')
23: index++;
24: if(production[i][index]!=0) {
25: beta=production[i][index+1];
26: printf("Grammar without left recursion:\n");
27: printf("%c->%c%c\'",non_terminal,beta,non_terminal);
28: printf("\n%c\'->%c%c\'|E\n",non_terminal,alpha,non_terminal);
29: }
30: else
31: printf(" can't be reduced\n");
32: }
33: else
34: printf(" is not left recursive.\n");
35: index=3;
36: }
37: }
Source: csbeans.blogspot.com
All those coders who are working on the Whatever based application and are stuck on Write a program to check whether a grammar is left recursive or not, if it is remove left recursion can get a collection of related answers to their query. Programmers need to enter their query on Write a program to check whether a grammar is left recursive or not, if it is remove left recursion related to Whatever code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about Write a program to check whether a grammar is left recursive or not, if it is remove left recursion for the programmers working on Whatever code while coding their module. Coders are also allowed to rectify already present answers of Write a program to check whether a grammar is left recursive or not, if it is remove left recursion while working on the Whatever language code. Developers can add up suggestions if they deem fit any other answer relating to "Write a program to check whether a grammar is left recursive or not, if it is remove left recursion". Visit this developer's friendly online web community, CodeProZone, and get your queries like Write a program to check whether a grammar is left recursive or not, if it is remove left recursion resolved professionally and stay updated to the latest Whatever updates.