Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Take a string aab which is generated by given language. There are two ways to generate aab : 1) S -> aS -> aT (S->T)
Take a string aab which is generated by given language.
There are two ways to generate "aab" :
1) S -> aS -> aT (S->T) -> aaR (T->aR) -> aabR (R->bR) -> aab (R-> null)
2) S -> Sb -> aSb (S ->aS) -> aTb ( S->T) -> aaRb (T->aR) -> aab (R->null)
Hence the given grammar is ambiguous
This is the answer for question 6, I want answer for question 7!
6. [1 mark Consider the following grammar S a SIS b IT T c T l a R R b RIE Prove that the grammar is ambiguous. 7. [1 mark] Write an unambiguous grammar in BNF that describes the same language as the grammar described in question 6. HINT: First write an EBNF grammar of the sentences produced by the ambiguous grammar. Your BNF grammar must be able to generate all these sentences (but no more) and be unambiguous. Don't just try to modify the original grammar in the hope that you can fix itStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started