in Compiler Design
363 views
2 votes
2 votes

Confusion in follow of A,Please clarify.

in Compiler Design
363 views

1 comment

$follow (A)=follow(S)$

$follow (S)=first (A)$

$first(A)=(a,\epsilon)$

replace the production $S\rightarrow bSA$ with $\epsilon$ we get $S\rightarrow bS, follow(S)=(\$,a)$
1
1

1 Answer

3 votes
3 votes
Non terminals First Follow
$S$ $\left \{ a,b \right \}$ $\left \{ \$,a \right \}$
$A$ $\left \{ a,\epsilon \right \}$ $\left \{\$ ,a \right \}$

 

Now the predictive parsing table :-

Non terminals $a$ $b$ $\$$
$S$ $S\to aS$ $S\to bSA$  
$A$

$A\to a$

$A\to \epsilon$

  $A\to \epsilon$

So for $M[A,a]$ we have two entries 

$A\to a$

$A\to \epsilon$ .

edited by