answersLogoWhite

0

AllQ&AStudy Guides
Best answer

J. P. Pickens died on 1973-07-06.

This answer is:
Related answers

J. P. Pickens died on 1973-07-06.

View page

J. P. Pickens was born on 1937-05-06.

View page

#include"stdio.h"

#include<conio.h>

#define max 10

#define MAX 15

char array[max][MAX],temp[max][MAX];

int c,n,t;void fun(int,int[]);

int fun2(int i,int j,int p[],int key)

{

int k;

if(!key)

{

for(k=0;k<n;k++)

if(array[i][j]==array[k][0])

break;

p[0]=i;p[1]=j+1;

fun(k,p);

return 0;

}

else

{

for(k=0;k<=c;k++)

{

if(array[i][j]==temp[t][k])

break;

}

if(k>c)return 1;

else return 0;

}

}

void fun(int i,int p[])

{

int j,k,key;

for(j=2;array[i][j]!='\0';j++)

{

if(array[i][j-1]=='/')

{

if(array[i][j]>='A'&&array[i][j]<='Z')

{

key=0;

fun2(i,j,p,key);

}

else

{key=1;

if(fun2(i,j,p,key))

temp[t][++c]=array[i][j];

if(array[i][j]=='[at]'&&p[0]!=-1)

{ //taking ,[at], as null symbol.

if(array[p[0]][p[1]]>='A'&&array[p[0]][p[1]]<='Z')

{

key=0;

fun2(p[0],p[1],p,key);

}

else

if(array[p[0]][p[1]]!='/'&&array[p[0]][p[1]]!='\0')

{

if(fun2(p[0],p[1],p,key))

temp[t][++c]=array[p[0]][p[1]];

}

}

}

}

}

}

char fol[max][MAX],ff[max];int f,l,ff0;

void ffun(int,int);

void follow(int i)

{

int j,k;

for(j=0;j<=ff0;j++)

if(array[i][0]==ff[j])

return 0;

if(j>ff0)ff[++ff0]=array[i][0];

if(i==0)fol[l][++f]='$';

for(j=0;j<n;j++)

for(k=2;array[j][k]!='\0';k++)

if(array[j][k]==array[i][0])

ffun(j,k);

}

void ffun(int j,int k)

{

int ii,null=0,tt,cc;

if(array[j][k+1]=='/'array[j][k+1]=='\0')

null=1;

for(ii=k+1;array[j][ii]!='/'&&array[j][ii]!='\0';ii++)

{

if(array[j][ii]<='Z'&&array[j][ii]>='A')

{

for(tt=0;tt<n;tt++)

if(temp[tt][0]==array[j][ii])break;

for(cc=1;temp[tt][cc]!='\0';cc++)

{

if(temp[tt][cc]=='[at]')null=1;

else fol[l][++f]=temp[tt][cc];

}

}

else fol[l][++f]=array[j][ii];

}

if(null)follow(j);

}

void main()

{

int p[2],i,j;

clrscr();

printf("Enter the no. of productions :");

scanf("%d",&n);

printf("Enter the productions :\n");

for(i=0;i<n;i++)

scanf("%s",array[i]);

for(i=0,t=0;i<n;i++,t++)

{

c=0,p[0]=-1,p[1]=-1;

temp[t][0]=array[i][0];

fun(i,p);

temp[t][++c]='\0';

printf("First(%c) : [ ",temp[t][0]);

for(j=1;j<c;j++)

printf("%c,",temp[t][j]);

printf("\b ].\n");

getch();

}

/* Follow Finding */

for(i=0,l=0;i<n;i++,l++)

{

f=-1;ff0=-1;

fol[l][++f]=array[i][0];

follow(i);

fol[l][++f]='\0';

}

for(i=0;i<n;i++)

{

printf("\nFollow[%c] : [ ",fol[i][0]);

for(j=1;fol[i][j]!='\0';j++)

printf("%c,",fol[i][j]);

printf("\b ]");

getch();

}

}

View page

#include"stdio.h"

#include<conio.h>

#define max 10

#define MAX 15

char array[max][MAX],temp[max][MAX];

int c,n,t;void fun(int,int[]);

int fun2(int i,int j,int p[],int key)

{

int k;

if(!key)

{

for(k=0;k<n;k++)

if(array[i][j]==array[k][0])

break;

p[0]=i;p[1]=j+1;

fun(k,p);

return 0;

}

else

{

for(k=0;k<=c;k++)

{

if(array[i][j]==temp[t][k])

break;

}

if(k>c)return 1;

else return 0;

}

}

void fun(int i,int p[])

{

int j,k,key;

for(j=2;array[i][j]!='\0';j++)

{

if(array[i][j-1]=='/')

{

if(array[i][j]>='A'&&array[i][j]<='Z')

{

key=0;

fun2(i,j,p,key);

}

else

{key=1;

if(fun2(i,j,p,key))

temp[t][++c]=array[i][j];

if(array[i][j]=='[at]'&&p[0]!=-1)

{ //taking ,[at], as null symbol.

if(array[p[0]][p[1]]>='A'&&array[p[0]][p[1]]<='Z')

{

key=0;

fun2(p[0],p[1],p,key);

}

else

if(array[p[0]][p[1]]!='/'&&array[p[0]][p[1]]!='\0')

{

if(fun2(p[0],p[1],p,key))

temp[t][++c]=array[p[0]][p[1]];

}

}

}

}

}

}

char fol[max][MAX],ff[max];int f,l,ff0;

void ffun(int,int);

void follow(int i)

{

int j,k;

for(j=0;j<=ff0;j++)

if(array[i][0]==ff[j])

return 0;

if(j>ff0)ff[++ff0]=array[i][0];

if(i==0)fol[l][++f]='$';

for(j=0;j<n;j++)

for(k=2;array[j][k]!='\0';k++)

if(array[j][k]==array[i][0])

ffun(j,k);

}

void ffun(int j,int k)

{

int ii,null=0,tt,cc;

if(array[j][k+1]=='/'array[j][k+1]=='\0')

null=1;

for(ii=k+1;array[j][ii]!='/'&&array[j][ii]!='\0';ii++)

{

if(array[j][ii]<='Z'&&array[j][ii]>='A')

{

for(tt=0;tt<n;tt++)

if(temp[tt][0]==array[j][ii])break;

for(cc=1;temp[tt][cc]!='\0';cc++)

{

if(temp[tt][cc]=='[at]')null=1;

else fol[l][++f]=temp[tt][cc];

}

}

else fol[l][++f]=array[j][ii];

}

if(null)follow(j);

}

void main()

{

int p[2],i,j;

clrscr();

printf("Enter the no. of productions :");

scanf("%d",&n);

printf("Enter the productions :\n");

for(i=0;i<n;i++)

scanf("%s",array[i]);

for(i=0,t=0;i<n;i++,t++)

{

c=0,p[0]=-1,p[1]=-1;

temp[t][0]=array[i][0];

fun(i,p);

temp[t][++c]='\0';

printf("First(%c) : [ ",temp[t][0]);

for(j=1;j<c;j++)

printf("%c,",temp[t][j]);

printf("\b ].\n");

getch();

}

/* Follow Finding */

for(i=0,l=0;i<n;i++,l++)

{

f=-1;ff0=-1;

fol[l][++f]=array[i][0];

follow(i);

fol[l][++f]='\0';

}

for(i=0;i<n;i++)

{

printf("\nFollow[%c] : [ ",fol[i][0]);

for(j=1;fol[i][j]!='\0';j++)

printf("%c,",fol[i][j]);

printf("\b ]");

getch();

}

}

View page

#include<stdio.h>

#include<conio.h>

#include<string.h>

void main()

{

char t[5],nt[10],p[5][5],first[5][5],temp;

int i,j,not,nont,k=0,f=0;

clrscr();

printf("\nEnter the no. of Non-terminals in the grammer:");

scanf("%d",&nont);

printf("\nEnter the Non-terminals in the grammer:\n");

for(i=0;i<nont;i++)

{

scanf("\n%c",&nt[i]);

}

printf("\nEnter the no. of Terminals in the grammer: ( Enter e for absiline ) ");

scanf("%d",&not);

printf("\nEnter the Terminals in the grammer:\n");

for(i=0;i<nott[i]=='$';i++)

{

scanf("\n%c",&t[i]);

}

for(i=0;i<nont;i++)

{

p[i][0]=nt[i];

first[i][0]=nt[i];

}

printf("\nEnter the productions :\n");

for(i=0;i<nont;i++)

{

scanf("%c",&temp);

printf("\nEnter the production for %c ( End the production with '$' sign )

:",p[i][0]);

for(j=0;p[i][j]!='$';)

{

j+=1;

scanf("%c",&p[i][j]);

}

}

for(i=0;i<nont;i++)

{

printf("\nThe production for %c -> ",p[i][0]);

for(j=1;p[i][j]!='$';j++)

{

printf("%c",p[i][j]);

}

}

for(i=0;i<nont;i++)

{

f=0;

for(j=1;p[i][j]!='$';j++)

{

for(k=0;k<not;k++)

{

if(f==1)

break;

if(p[i][j]==t[k])

{

first[i][j]=t[k];

first[i][j+1]='$';

f=1;

break;

}

else if(p[i][j]==nt[k])

{

first[i][j]=first[k][j];

if(first[i][j]=='e')

continue;

first[i][j+1]='$';

f=1;

break;

}

}

}

}

for(i=0;i<nont;i++)

{

printf("\n\nThe first of %c -> ",first[i][0]);

for(j=1;first[i][j]!='$';j++)

{

printf("%c\t",first[i][j]);

}

}

getch();

}

View page
Featured study guide
📓
See all Study Guides
✍️
Create a Study Guide
Search results