edited by
2,109 views
0 votes
0 votes

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

$S \rightarrow D H T U$$ \left\{S.v a l = D.val + H.val + T.val + U.val\right\};$
$D \rightarrow ^{"} \mathrm{M}^{"} D_1$$\left\{D.val =5+D_{1}.val \right\};$
$D \rightarrow \epsilon$$\left\{D.val = -5 \right\};$
$H \rightarrow ^{"}\mathrm{L}^{"} H_1$$\left\{H.val = 5^{*} 10+H_{1}.v a l\right\};$ 
$H \rightarrow \epsilon$$\left\{H.val = -10 \right\};$
$T \rightarrow \text {"C" } T_1$$\left\{T.v a l=5^{*} 100+T_{1}. val;\right\};$
$T \rightarrow \epsilon$$\left\{T . v a l= - 5\right\};$
$U \rightarrow$ "K"$\left\{U . v a l = 5 \right\};$

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$)?

  1. $45$
  2. $50$
  3. $55$
  4. $65$ 
edited by

2 Answers

Answer:

Related questions

1 votes
1 votes
1 answer
1
Arjun asked Feb 16
2,327 views
Which of the following is/are Bottom-Up Parser(s)?Shift-reduce ParserPredictive ParserLL$(1)$ Parser LR Parser
0 votes
0 votes
1 answer
3