21brs1475 Compiler Design Lab7
21brs1475 Compiler Design Lab7
CODE:
#include <ctype.h>
#include <stdio.h>
#include <string.h>
int count, n = 0;
if (xxx == 1)
continue;
// Calling function
find_first(c, 0, 0);
ptr += 1;
if (first[i] == final_first[point1][fs]) {
chk = 1;
break;
}
}
if (chk == 0) {
printf("%c, ", first[i]);
final_first[point1][point2++] = first[i];
}
}
printf("}\n");
jm = n;
point1++;
}
printf("\n");
// printf("=================================""\n\n");
char donee[count];
ptr = -1;
if (xxx == 1)
continue;
land += 1;
// Function call
follow(ck);
ptr += 1;
void follow(char c)
{
int i, j;
if (production[i][j + 1] == '\0'
&& c != production[i][0]) {
// Calculate the Follow of thenon-terminal in the L.H.S. of theproduction
follow(production[i][0]);
}
}
}
}
}
// Including the First set of the non-terminal in the Follow ofthe original query
while (final_first[i][j] != '!') {
if (final_first[i][j] != '#') {
f[m++] = final_first[i][j];
}
else {
if (production[c1][c2] == '\0') {
// The case where we will reach theend of the production
follow(production[c1][0]);
}
else {
// Recursion to the next symbolin case we encounter a "#"
grammarfollow(production[c1][c2], c1,
c2 + 1);
}
}
j++;
}
}
}
OUTPUT: