in Compiler Design
148 views
1 vote
1 vote

Confusion in follow of A,Please clarify.

in Compiler Design
148 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

2 votes
2 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