edited by
11,149 views

3 Answers

Best answer
5 votes
5 votes

first(S)= {1 ,∧}      follow(S) ={$}

first(A)={1,0}        follow(A)={1}

first(B)={ 0 }        follow(B)={$}

first(C)= { 1 }       follow(C)={1}

LL(1) table

  1 0 $
S S->1AB   S->^
A A->1AC A->0C  
B   B->0S  
C C->1    

So grammer is LL(1) grammer

selected by
6 votes
6 votes

Yes, this grammar is LL(1) ,

1) there is no left recursion.

2) there is no left factoring.

3) there are no multiple entries in a parsing table .

4) most important , this grammar is unambiguous .

3 votes
3 votes

First(S)={1,^}     Follow(S)={$}

First(A)={1,0}    Follow(A)={0,1}

First(B)={0}       Follow(B)={$}

First(C)={1}       Follow(C)={0,1}

Predictive Parsing (LL(1)) Table:

  0 1 $
S   S-->1AB S-->^
A

A-->0C

A--->^

A-->1AC

A-->^

 
B B-->0S   B-->^
C C-->^

C-->1 

C-->^

 

Since, the above parsing table has multiple entries, therefore it is not LL(1).

Related questions

0 votes
0 votes
0 answers
2
2 votes
2 votes
0 answers
3
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).
0 votes
0 votes
1 answer
4
Hirak asked Jun 1, 2019
2,030 views
S → aSbS /bSaS / ϵS → aABb A→ c/ ϵ B → d/ ϵWhich of the following is LL1. Explain in details.