Which of the following statements is/are TRUE? (a) The grammar S → SS | a is ambiguous. (Where S is the start symbol) (b) The grammar S → 0S1 | 01S |e is ambiguous. (The special symbol e represents the empty string) (Where S is the start symbol) (c) The grammar (Where S is the start symbol) S → T / U T → x S y | xy | ϵ U → yT generates a language consisting of the string yxxyy.
Which of the following statements is/are TRUE? (a) The grammar S → SS | a is ambiguous. (Where S is the start symbol) (b) The grammar S → 0S1 | 01S |e is ambiguous. (The special symbol e represents the empty string) (Where S is the start symbol) (c) The grammar (Where S is the start symbol) S → T / U T → x S y | xy | ϵ U → yT generates a language consisting of the string yxxyy. Correct Answer All of (a), (b) and (c) are TRUE.
The correct answer is option 4.
CONCEPT:
For grammar to be ambiguous, a string needs to have
More than one parse tree
More than two leftmost derivative
More than two rightmost derivative
Key Points
The grammar S → SS | a is ambiguous grammar. It generates two parse trees with string aaa.
[ alt="F1 Raju Shraddha 07.04.2020 D10" src="//storage.googleapis.com/tb-img/production/21/04/F1_Raju_Shraddha_07.04.2020_D10.png" style="width: 216px; height: 177px;">
The grammar S → 0S1 | 01S |e is ambiguous. It generates two parse trees with string 01.
[ alt="F1 Raju Shraddha 07.04.2020 D11 1" src="//storage.googleapis.com/tb-img/production/21/04/F1_Raju_Shraddha_07.04.2020_D11_1.png" style="width: 217px; height: 123px;">
The grammar S → T / U, T → x S y | xy | ϵ, U → yT generates a language consisting of the string yxxyy.
[ alt="F1 Raju Shraddha 07.04.2020 D12 1" src="//storage.googleapis.com/tb-img/production/21/04/F1_Raju_Shraddha_07.04.2020_D12_1.png" style="width: 144px; height: 358px;">
∴ Hence the correct answer is All of (a), (b) and (c) are TRUE.