Left Recursion
Left Recursion
h>
#include <string.h>
char *a = q[0];
char *b = q[q_count - 1];
if (a[0] == a[3]) {
char x[50];
strcpy(x, &a[4]);
char y = a[0];
printf("%c->%s%c'\n", y, b, y);
printf("%c'->%s%c'", y, x, y);
printf("|eps\n");
} else {
printf("%s\n", s[i]);
}
}
}
}
void main() {
printf("Enter the number of Production Rules: ");
int n;
scanf("%d", &n);
fflush(stdin); // Flush input buffer
eliminateLeftRecursion(s, n);
}