mikesr 0 Newbie Poster

Hello,

I am not quiet sure if the assignment is solved correctly. Could somebody check it for me, please?

A ::= Bc | Dd | By
B ::= Bbx | z | y
D ::= Bz | Dm

After left recursion and left factoring:

A ::= BA* | Dd
A* ::= c | y
B ::= zB* | yB*
B* :: = ε | bxB*
D ::= BzD*
D* :: = ε | mD*

First and follow:

FIRST(A) = {z,y}
FIRST(A*) = {c,y}
FIRST(B) = {z,y}
FIRST(B*) = {ε,b}
FIRST(D) = {z,y}
FIRST(D*)={ε, m}

FOLLOW(A) = 0
FOLLOW(B) = FOLLOW(B) + FIRST(A*) U FOLLOW(B) + FIRST(z) = {c,y,z}
FOLLOW(B*) = 0
FOLLOW(D) = FOLLOW(D) + FIRST(d) = {d}
FOLLOW(D*) = 0

it's not LL(1) grammar.

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.