edited by
3,004 views

1 Answer

2 votes
2 votes

S->FR 

R->*S/∈ 

F->id

FIRST(S) = FIRST(FR) = FIRST(F) = { id }

For R->*S,  FIRST(R) = { * }

For R->∈ ,  FIRST(R) = { ∈ },  FOLLOW(R) = FOLLOW(S) = { $ }

So both productions will be placed in different column

FIRST(F) = { id }

So above grammer can be parsed by LL(1) and parsing table is as follows:

  * id $
S - S->FR -
R R->*S - R->∈ 
F - F->id -

for 2nd one

S->iEtSS' | a 
S'->eS | ∈ 
E->b

for S->iEtSS', FIRST(S) = { i }

for S->a, FIRST(S) = { a }

for S'->eS, FIRST(S') = { e }

for S'->∈, FIRST(S') = { ∈ } and FOLLOW(S') = FOLLOW(S) = FIRST(S') U { dollar } = { dollar,e }

Since in column e there will be two productions so it cant be parsed using LL(1) parser.

FIRST(E) = { b }

So above grammer cant be parsed by using LL(1) parser

Related questions

4 votes
4 votes
1 answer
3
Kapil asked Dec 27, 2016
19,837 views
Consider a Grammar G as follows :$S\rightarrow W$$W \rightarrow ZXY / XY$$Y\rightarrow c/\epsilon$$Z\rightarrow a/d$$X\rightarrow Xb/\epsilon$Draw the LL(1) parsing table...
0 votes
0 votes
1 answer
4
Sagar Chintawar asked Feb 11, 2019
679 views
Construct the predictive parsing table for the grammar and tell whether the grammar is LL(1) or notS (L) / aL L, S / S