GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 45

Consider the following grammar:

S → A$
A → (AB)
A → ε
B → (A) 
B → x

Which of the following s the correct parse tree for the string?

((x)x)$ 

(A)

(B)

(C)

(D) None of these.


Answer: (C)

Explanation: Correct parse tree for given grammar is:

So, option (C) is correct.

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.