The Gateway to Computer Science Excellence
0 votes
81 views
  1. S → aSbS /bSaS / ϵ
  1. S → aABb 

           A→ c/ ϵ

           B → d/ ϵ

Which of the following is LL1. Explain in details.

in Compiler Design by Active (3.5k points) | 81 views
0
both in LL1

LL1 only checks FIRST of grammar and if there same alphabet or not.
+1
But it is mentioned that 1 is not LL1
0
yes, thanks for correcting

1 Answer

+3 votes
Best answer

$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).$

by Veteran (117k points)
selected by
0
Thanks.. :)
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,651 questions
56,214 answers
194,173 comments
95,428 users