2,030 views
0 votes
0 votes
  1. S → aSbS /bSaS / ϵ
  1. S → aABb 

           A→ c/ ϵ

           B → d/ ϵ

Which of the following is LL1. Explain in details.

1 Answer

Best answer
6 votes
6 votes

$1)$ $FT(S)=\left \{ a,b,\epsilon \right \}$

$FL(S)=${ a,b,$}

NonTerminal      
  a b $
S $S->aSbS$. ,  $S->\epsilon $ $S->bSaS$. ,  $S->\epsilon $ $S->\epsilon $

 

yes it is not $LL(1).$


$2)$ $FT(S)=\left \{ a \right \}$

$FT(A)=\left \{ c,\epsilon \right \}$

$FT(B)=\left \{ d,\epsilon \right \}$

$FL(S)=${$}

$FL(A)=${d,b}

$FL(B)=${b}

NonTerminal          
  a b c d $
$S$ $S->aABb$        
$A$   $A\rightarrow \epsilon$ $A\rightarrow c$ $A\rightarrow \epsilon$  
$B$   $B\rightarrow \epsilon$   $B->d$  

 

It is $LL(1).$

selected by

Related questions

2 votes
2 votes
4 answers
1
0 votes
0 votes
0 answers
3
2 votes
2 votes
0 answers
4
admin asked Aug 20, 2019
365 views
Show that the following grammar:$S\rightarrow AaAb\mid BbBa$$A\rightarrow \epsilon$$A\rightarrow\epsilon$is LL(1) but not SLR(1).