#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
#include<process.h>
void main()
{
clrscr();
char *s1,*s2,*o1,*o2,temp1,temp2;
printf("Enter first statement:");
gets(s1);
printf("Enter second statement:");
gets(s2);
if(s1[0]!=s2[0])
{
printf("Sorry");
getch();
exit(0);
}
o1[0]=s1[0];
o1[1]='-';
o1[2]='>';
for(int i=3;s1[i]==s2[i];i++)
o1[i]=s1[i];
temp1=i;
temp2=i;
o1[i++]='Z';
o1[i++]='\0';
o2[0]='Z';
o2[1]='-';
o2[2]='>';
int p=3;
for(int j=temp1;j<strlen(s1);j++)
{ o2[p]=s1[j];
p++;
}
o2[p++]='/';
for(j=temp2;j<strlen(s2);j++)
{
o2[p]=s2[j];
p++;
}
o2[p++]='\0';
puts(o1);
puts(o2);
getch();
}
To implement left factoring in a given grammar using C, first, identify the common prefixes in the production rules. Create a new non-terminal symbol to represent the factored part, and rewrite the productions accordingly. Use a function to parse the grammar, detect the common prefixes, and generate the factored grammar. Finally, display the updated grammar with the left-factored rules.
Grammar
a
Easy Grammar Plus is a easy grammar homeschool curriculum by Wanda C. Phillips, Ed.D.
C. B. Greiss has written: 'A German grammar' -- subject(s): German language, Grammar
(B) The word for the application of proper English usage is "grammar".
Nora C. England has written: 'Mam grammar in outline' -- subject(s): Grammar, Mam language
H. C. Scholberg has written: 'Concise grammar of the Hindi language' -- subject(s): Grammar, Hindi language
Well, honey, to factor that little equation C squared plus C minus 56, you're gonna want to break out the ol' quadratic formula. Factor that bad boy into (C + 8)(C - 7) and call it a day. Trust me, it's as easy as stealing candy from a baby.
Robert C. Pinckert has written: 'Pinckert's practical grammar' -- subject(s): Accessible book, Rhetoric, Grammar, English language
Cricket starts with c but not k because that is the correct grammar.
0