Very Nice :)

Just a doubt ?

$X\rightarrow Xb$ won't go in $c$ and $ ?

The Gateway to Computer Science Excellence

+7 votes

Best answer

S→W

W→ZXY / XY

Y→c/ϵ

Z→a/d

X→Xb/ϵ

First(S) = { a, d, b, c, d, ϵ} , Follow(S) = { $ }

First(W) = { a, d, b, c, d, ϵ} , Follow(W) = { $ }

First(X) = { b, ϵ} , Follow(X) = {b, c,$ }

First(Y) = { c, ϵ} , Follow(Y) = { $ }

First(Z) = { a, d} , Follow(Z) = { b, c, $ }

LL(1) Table-

Place A -> B in the first of B in row A.

If A -> B , and first of A =ϵ or B **=** ϵ , then place A-> B, in the follow of A.

a | b | c | d | $ | |

S | S->W | S->W | S->W | S->W | S->W |

W | W->ZXY | W->XY | W->XY | W->ZXY | W->XY |

X |
X->Xb X->$\epsilon$ |
X->$\epsilon$ | X->$\epsilon$ | ||

Y | Y->c | Y->$\epsilon$ | |||

Z | Z->a | Z->d |

Because of X-> Xb and X -> ϵ , going in same block, given grammar is not LL(1).

??

0

I don't think so..

X-> Xb would go only in the **first of (Xb)** right ?? And first of Xb = { b } ..right ??

0

Okk !!

I am not sure but just thought that first of {Xb} = first of {X}

And, First of {X} = {b,c,$} ?

- All categories
- General Aptitude 1.9k
- Engineering Mathematics 7.5k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.4k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.2k
- Non GATE 1.4k
- Others 1.4k
- Admissions 595
- Exam Queries 573
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 18

50,737 questions

57,370 answers

198,506 comments

105,276 users