Answered step by step
Verified Expert Solution
Link Copied!

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)

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2019 Wurzburg Germany September 16 20 2019 Proceedings Part 2 Lnai 11907

Authors: Ulf Brefeld ,Elisa Fromont ,Andreas Hotho ,Arno Knobbe ,Marloes Maathuis ,Celine Robardet

1st Edition

3030461467, 978-3030461461

More Books

Students also viewed these Databases questions

Question

13. You always should try to make a good first impression.

Answered: 1 week ago