15 15 votes Consider the following syntax-directed definition $\text{(SDD)}$.$$\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\} \\ \hlineH \rightarrow \epsilon & \left\{H.val = -10; \right\} \\ \hlineT \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 $\text{"MMLK"}$ as the input, which one of the following options is the $\text{CORRECT}$ value computed by the $\text{SDD}$ (in the attribute $S.val$)?$45$$50$$55$$65$ Compiler Design gatecse-2024-set1 compiler-design syntax-directed-translation two-marks + – Arjun 14.1k views answer comment Share Follow Print See 1 comment 1 1 comment reply chidambareswar23 commented Jan 31 reply Follow flag All questions related to Syntax Directed Definitions(SDD):Compiler Design: GATE CSE 1992 | Question: 11aCompiler Design: GATE CSE 2003 | Question: 18Compiler Design: GATE CSE 2003 | Question: 59Compiler Design: GATE CSE 2019 | Question: 36Compiler Design: GATE CSE 2020 | Question: 33Compiler Design: GATE CSE 2024 | Set 1 | Question: 27Compiler Design: GATE CSE 2024 | Set 2 | Question: 19Compiler Design: GATE CSE 2025 | Set 2 | Question: 12 1 1 replyShare Please log in or register to add a comment.
Best answer 29 29 votes Answer : 45 shishir__roy answered Feb 16, 2024 • selected Jul 14, 2025 by Shaik Masthan shishir__roy comment Share Follow See all 5 Comments 5 5 Comments reply Show 2 previous comments Ayush 3 commented Jan 25, 2025 reply Follow flag Why there no Derivation from T-> CT1->T->e ??? Please answer .. 0 0 replyShare srishti_13 commented Jan 27, 2025 reply Follow flag @Ayush 3 cuz we don't need "C" in string "MMLK" 1 1 replyShare Nebula commented Jan 30 reply Follow flag If someone is confused like I was about quotes (" ") actually the alphabets inside quotes are terminals. quotes are just used to show them like that here. So we first generated the parse tree then inputed the values according to the rules. Also, in D->"M"D1 .... D1 is just another instance of D. 0 0 replyShare Please log in or register to add a comment.
4 4 votes So the output of the given SDT is $45$.Option $(A)$ is correct.Similar types of concepts asked in GATE CSE 2023 | Question: 50 Hira Thakur answered Feb 16, 2024 Hira Thakur comment Share Follow 0 reply Please log in or register to add a comment.
1 1 vote So, the output of the given SDT is 45. i_m_sudip answered Dec 14, 2024 i_m_sudip comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes ansewer is 45 Abhi_Ramg answered Aug 7 Abhi_Ramg comment Share Follow 0 reply Please log in or register to add a comment.