You are on page 1of 1

#include<stdio.

h>
#include<conio.h>
#include<string.h>
void main()
{
int count,i,j;
char a[10],prod,alpha[10],a1[10];
clrscr();
printf("Enter the grammer");
get(a);
if(a[0]==a[3])
{
printf("\n Left recursive");
prod=a[3];
for(i=4;a[i]!='|';i++)
{
alpha[j]=a[i];
j++;
count++;
}
for(j=count;a[j]!='\0';j++)
{
a1[j]=a[j];
}
a1[j]='\0';
printf("\n \t After removing");
printf("\n\n\n %c->%c %c",prod,a1,prod);
printf("\n \n \t %c/->%c %c '|e",prod,alpha,prod);
}
else
{
printf("\n\n\t Not Left Recursive:");
}
getch();
}

You might also like