3,043 views
0 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 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
Position:
Show:

Related questions

2 2 votes
4 4 answers
1.9k
1.9k views
Hirak asked Jun 4, 2019
1,882 views
S→ A/aA→ aLL1 or not?
0 0 votes
1 1 answer
630
630 views
vishnu777 asked Nov 25, 2022
630 views
"Every Regular Grammar has a Right linear grammar and this is LL(1)"What is meaning of this statement exactly and does it hold always?My Assumptions:If a grammar is right...
0 0 votes
2 2 answers
1.1k
1.1k views
Ebrahim asked Jan 12, 2024
1,115 views
Q1. For the following grammar N - AB | BA A - a | CAC B - b | CBC C - a | b Find the FIRST and FOLLOW
0 0 votes
0 0 answers
720
720 views
admin asked Aug 20, 2019
720 views
Show that the following grammar:$S\rightarrow SA\mid A$$A\rightarrow a$is SLR(1) but not LL(1).