#include<stdio.h>
#include<type.h>
void first(char);
int count,n=0;
char produn[10][10], FIRST[10];
main()
{
int i,choice;
char c,ch;
printf("How many productions??");
scanf("%d",&count);
printf("Enter %d production epsilon =$ "\n\n");
for(i=0;i<count;i++)
scanf("%s%c",prodn[i],&ch);
do
{
n=0;
printf("Elements:");
scanf("%c",&c);
FIRST(c);
printf("\n FIRST (%c) ={","c);
for(i=0;i<=n;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 i;
if (!(isuper(c))first[n++]=c);
for(j=0;j<count;j++)
{
if(prodn[j][2]=="$")FIRST[n++]='$';
}
else
FIRST(prodn[j][2]);
}
}
}
#include<type.h>
void first(char);
int count,n=0;
char produn[10][10], FIRST[10];
main()
{
int i,choice;
char c,ch;
printf("How many productions??");
scanf("%d",&count);
printf("Enter %d production epsilon =$ "\n\n");
for(i=0;i<count;i++)
scanf("%s%c",prodn[i],&ch);
do
{
n=0;
printf("Elements:");
scanf("%c",&c);
FIRST(c);
printf("\n FIRST (%c) ={","c);
for(i=0;i<=n;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 i;
if (!(isuper(c))first[n++]=c);
for(j=0;j<count;j++)
{
if(prodn[j][2]=="$")FIRST[n++]='$';
}
else
FIRST(prodn[j][2]);
}
}
}
No comments:
Post a Comment