Question

Please help with the following context free grammar over alphabet (0,1): S —> A | B...

Please help with the following context free grammar over alphabet (0,1):
S —> A | B
A —> 1S | ^
B—> 0S | ^

a. Show that the grammar is ambiguous for a non-empty string.

b. Convert the CFG to Chomsky normal Form.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

a)String is 1

leftmost derivation i)

S->A

->1S

->1A

->1

leftmost derivation ii)

S->A

->1S

->1B

->1

two leftmost derivations for string 1

so the grammar is ambigous.

b)

S —> A becomes

S->AX

X-> ^

S->B becomes

S->BX

A->1S becomes

A->YS

Y->1

A->^ is same

B->0S becomes

B->ZS

Z->0

B->^ is same

chomsky normal form is

S->AX

X-> ^

S->BX

A->YS

Y->1

A->^

B->ZS

Z->0

B->^

Add a comment
Know the answer?
Add Answer to:
Please help with the following context free grammar over alphabet (0,1): S —> A | B...
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