#include
#include
void
FIRST(char );
intcount,n=0;
charprodn[10][10],
first[10];
main(){
inti,choice;
charc,ch;
printf("How
many productions ? :");
scanf("%d",&count);
printf("Enter
Number Of Productions :");
for(i=0;i
scanf("%s%c",prodn[i],&ch);
do{
n=0;
printf("Element :");
scanf("%c",&c);
FIRST(c);
printf("\n FIRST(%c)= {
",c);
for(i=0;i
printf("%c ",first[i]);
printf("}\n");
printf("press 1 to continue
: ");
scanf("%d%c",&choice,&ch);
}
while(choice==1);
}
void
FIRST(char c){
int
j;
if(!(isupper(c)))first[n++]=c;
for(j=0;j
if(prodn[j][0]==c){
if(prodn[j][2]=='$')
first[n++]='$';
else
if(islower(prodn[j][2]))first[n++]=prodn[j][2];
else FIRST(prodn[j][2]);
}
}
}