Question: 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

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 it

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!