Which of the following language(s) generates more than one parse tree for a string ?
L1 = {a^nb^mc^md^n ∈ {a, b, c, d}* | n, m ≥ 0}
∪ {a^nb^nc^md^m ∈ {a, b, c, d}* | n, m ≥ 0}
L2 = {a^nb^mc^m ∈ {a, b, c}* | n, m ≥ 0}
∪ {a^nb^nc^m ∈ {a, b, c}* | n, m ≥ 0}
L3 = {a^nb^mc^p ∈ {a, b, c}* | n ≠m; n, m ≥ 0}
∪ {a^nb^mc^p ∈ {a, b, c}* | m ≠p; n, m ≥ 0}
(A) Only L1 and L2
(B) Only L1 and L3
(C) Only L2 and L3
(D) All L1, L2, and L3
Answer: (D)
Explanation: All given languages are inherently ambiguous and generates more than one parse tree for some string(s).
Option (D) is correct.
Quiz of this Question
Level Up Your GATE Prep!
Embark on a transformative journey towards GATE success by choosing
Data Science & AI as your second paper choice with our specialized course. If you find yourself lost in the vast landscape of the GATE syllabus, our program is the compass you need.
Last Updated :
10 Jan, 2018
Like Article
Save Article