GATEverse
← GATE CSE 2024 Set 1

Q27

MCQ2 marks, −0.67

Consider the following syntax-directed definition (SDD)\text{(SDD)}.

S→DHTU{S.val=D.val+H.val+T.val+U.val;}D→"M"D1{D.val=5+D1.val;}D→ϵ{D.val=−5;}H→"L"H1{H.val=5∗10+H1.val;}H→ϵ{H.val=−10;}T→"C" T1{T.val=5∗100+T1.val;}T→ϵ{T.val=−5;}U→"K"{U.val=5;}\begin{array}{|l|l|} \hline \text{$S \rightarrow D H T U$} & \text{$ \left\{S.v a l = D.val + H.val + T.val + U.val;\right\}$} \\ \hline D \rightarrow ^{"} \mathrm{M}^{"} D_1 & \left\{D.val =5+D_{1}.val; \right\} \\ \hline D \rightarrow \epsilon & \left\{D.val = -5; \right\} \\ \hline H \rightarrow ^{"}\mathrm{L}^{"} H_1 & \left\{H.val = 5^{*} 10+H_{1}.v a l;\right\} \\ \hline H \rightarrow \epsilon & \left\{H.val = -10; \right\} \\ \hline T \rightarrow \text {"C" } T_1 & \left\{T.v a l=5^{*} 100+T_{1}. val;\right\} \\ \hline T \rightarrow \epsilon & \left\{T . v a l= - 5;\right\} \\ \hline U \rightarrow \text{"K"} & \left\{U . v a l= 5;\right\} \\ \hline \end{array}

Given "MMLK"\text{"MMLK"} as the input, which one of the following options is the CORRECT\text{CORRECT} value computed by the SDD\text{SDD} (in the attribute S.valS.val)?

Sign in to save attempts.

Loading…