Question: please explain the steps If G is the grammar S + SbS a. show that G is ambiguous. Solution To prove that G is ambiguous,

 please explain the steps If G is the grammar S +

SbS a. show that G is ambiguous. Solution To prove that G

please explain the steps

If G is the grammar S + SbS a. show that G is ambiguous. Solution To prove that G is ambiguous, we have to find a # E LIG), which is ambiguous. Consider w = abababa e LG). Then we get two derivation trees for w (see Fig. 6.11). Thus. G is ambiguous. In a CFG G. it may not be necessary to use all the symbols in VI. or all the productions in P for deriving sentences. So when we study a context- free language LIG). we try to eliminate those symbols and productions in G which are not useful for the derivation of sentences. Consider, for example. G = ([S. A. B. C. E), la, b, c). P. S) where P = 15 AB. A . B .BCEA It is easy to see that LIG) = {ab). Let G' = ({S. A. B). (a,b). PS)where P' consists of $ AB. A + B + b. LIG) = LG'). We have eliminated the symbols C, E and c and the productions B + CEA. We note the Lecture Notes 5: Context-Free Languages Cass CS345 10" February 2021 following points regarding the symbols and productions which are eliminated: 6) does not derive any terminal String. (1) E and do not appear in any sentential form. (UL) E-A is a null production (iv) B - C simply replaces B by C In this section, we give the construction to eliminate (1) variables not deriving terminal Strings. (ii) symbols not appearing in any sentential form, (iii) null productions, and (iv) productions of the form AB If G is the grammar S + SbS a. show that G is ambiguous. Solution To prove that G is ambiguous, we have to find a # E LIG), which is ambiguous. Consider w = abababa e LG). Then we get two derivation trees for w (see Fig. 6.11). Thus. G is ambiguous. In a CFG G. it may not be necessary to use all the symbols in VI. or all the productions in P for deriving sentences. So when we study a context- free language LIG). we try to eliminate those symbols and productions in G which are not useful for the derivation of sentences. Consider, for example. G = ([S. A. B. C. E), la, b, c). P. S) where P = 15 AB. A . B .BCEA It is easy to see that LIG) = {ab). Let G' = ({S. A. B). (a,b). PS)where P' consists of $ AB. A + B + b. LIG) = LG'). We have eliminated the symbols C, E and c and the productions B + CEA. We note the Lecture Notes 5: Context-Free Languages Cass CS345 10" February 2021 following points regarding the symbols and productions which are eliminated: 6) does not derive any terminal String. (1) E and do not appear in any sentential form. (UL) E-A is a null production (iv) B - C simply replaces B by C In this section, we give the construction to eliminate (1) variables not deriving terminal Strings. (ii) symbols not appearing in any sentential form, (iii) null productions, and (iv) productions of the form AB

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!