Skip to content
Official PYQ · 2021

GATE CS 2021 Set 1 Q31 — Parsing (LL, LR)

Explain with AI

Consider the following context-free grammar where the set of terminals is {a,b,c,d,f}\{a,b,c,d,f\}. S→d a T∣R fT→a S ∣ b a T ∣ϵR→c a T R ∣ϵ\begin{array}{lll} \text{S} & \rightarrow & d \: a \: \text{T} \mid \text{R} \: f \\ \text{T} & \rightarrow & a \: \text{S} \: \mid \: b \: a \: \text{T} \: \mid \epsilon \\ \text{R} & \rightarrow & c \: a \: \text{T} \: \text{R} \: \mid \epsilon \end{array}

The following is a partially-filled LL(1)\textsf{LL(1)} parsing table.abcdf$S1S→daT2TT→aST→baT3T→ε4RR→caTRR→ε\begin{array} {c c c } & a & b & c & d & f & \$ \\ \hline \text{S} & & & \boxed{1} & \text{S} \rightarrow da \text{T} & \boxed{2} & \\ \hline \text{T} & \text{T} \rightarrow a\text{S} & \text{T} \rightarrow ba\text{T} & \boxed{3} & & \text{T} \rightarrow \varepsilon & \boxed{4}\\ \hline \text{R} & & & \text{R} \rightarrow ca\text{T}\text{R} & & \text{R} \rightarrow \varepsilon & \end{array} Which one of the following choices represents the correct combination for the numbered cells in the parsing table (“blank” denotes that the corresponding cell is empty)?

Choose one option
View answer

Answer: A

Worked explanation not available yet.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Parsing (LL, LR) questions