Question

4. Consider two grammars Gi and G2 over the alphabet (a, b], with respective start symbols E and I and specified by the respective sets of production rules below: EFab (a) Do the two grammars generate the same language? If they do, briefly argue why. If they do not, provide a counter-example, that is, a word generated by one, but not by the other (b) The grammar G2 is unnecessarily complicated. Write a grammar that generates the same language generated by G2 but uses only one non-terminal symbol
0 0
Add a comment Improve this question Transcribed image text
Answer #1

(a)

  • No. These two grammars do not generate the same language. The grammar G2 can generate string "ab" but grammar G1 cannot generate "ab".
  • For grammar G1, minimum length is 4 for the string generated by this grammar and that string is "abab".
  • For grammar G2, minimum length is 2 for the string generated by this grammar and that string is "ab".
  • Thus, string "ab" cannot be generated by grammar G1 and thus these two grammar do not generate the same language.

(b)

  • The grammar that generates the same language as generated by G2 can be written as:
  • G\rightarrow Gab | \epsilon
  • Strings generated from this grammar G are "ab", "abab", "ababab" and many more which can be generated by grammar G2 also.
  • Thus, this grammar generates the same language and uses only one non-terminal symbol.
Add a comment
Know the answer?
Add Answer to:
4. Consider two grammars Gi and G2 over the alphabet (a, b], with respective start symbols...
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
  • How can we assess whether a project is a success or a failure? This case presents...

    How can we assess whether a project is a success or a failure? This case presents two phases of a large business transformation project involving the implementation of an ERP system with the aim of creating an integrated company. The case illustrates some of the challenges associated with integration. It also presents the obstacles facing companies that undertake projects involving large information technology projects. Bombardier and Its Environment Joseph-Armand Bombardier was 15 years old when he built his first snowmobile...

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
ADVERTISEMENT