Consider the grammar S → bSe S → PQR P → bPc P → ε Q → cQd Q → ε R → dRe R → ε…

PYQ GATE 1997

Consider the grammar

S → bSe

S → PQR

P → bPc

P → ε

Q → cQd

Q → ε

R → dRe

R → ε

where S, P, Q, and R are non-terminal symbols, with S as the start symbol; b, c, d, and e are terminal symbols; and ε is the empty string. This grammar generates strings of the form bicjdkem for some i, j, k, m ≥ 0.

(a) What is the condition on the values of i, j, k, and m?

(b) Find the smallest string that has two parse trees.

Sign up free to check your answer

Sign up free

Explore the full course: Compiler Design

Loading lesson…