Question

Convert the context free grammar to an equivalent grammar in Chomsky normal form: (show your work)...

Convert the context free grammar to an equivalent grammar in Chomsky normal form: (show your work)

S → AxAyA | BC

A → BB | a
B → bd | ε
C → SC | c

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Chomsky Normal Form format
S0 -> epsilon
NT -> NT NT
NT -> T

where NT = Non terminal and T = terminal

  • Given Grammar, put S0 as starting state

S0 -> S
S -> AxAyA | BC
A -> BB | a
B -> bd | ε
C -> SC | c

  • Remove epsilon productions

Removing B -> ε

S0 -> S
S -> AxAyA | BC | C
A -> BB | a | ε | B
B -> bd
C -> SC | c

Removing A -> ε

S0 -> S
S -> AxAyA | BC | AxAy | AxyA | xAyA | xy | Axy | xAy | xyA | C
A -> BB | a | B
B -> bd
C -> SC | c

Remove Unit productions

S0 -> AxAyA | BC | AxAy | AxyA | xAyA | xy | Axy | xAy | xyA | SC | c
S -> AxAyA | BC | AxAy | AxyA | xAyA | xy | Axy | xAy | xyA | SC | c
A -> BB | a | bd
B -> bd
C -> SC | c

  • Change Ts on the right side production to NTs if it is not unit production

S0 -> AXAYA | BC | AXAY | AXYA | XAYA | XY | AXY | XAY | XYA | SC | c
S -> AXAYA | BC | AXAY | AXYA | XAYA | XY | AXY | XAY | XYA | SC | c
A -> BB | a | ED
B -> ED
C -> SC | c
X -> x
Y -> y
E -> b
D -> d

  • Change into CNF

S0 -> FI | BC | FG | FH | XI | XY | FY | XG | XH | SC | c
S -> FI | BC | FG | FH | XI | XY | FY | XG | XH | SC | c
A -> BB | a | ED
B -> ED
C -> SC | c
X -> x
Y -> y
E -> b
D -> d
F -> AX
G -> AY
H -> YA
I -> GA

--------------------------------------
Hit the thumbs up if you are fine with the answer. Happy Learning!

Add a comment
Know the answer?
Add Answer to:
Convert the context free grammar to an equivalent grammar in Chomsky normal form: (show your work)...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT