Consider the syntax directed translation given by the following grammar and semantic rules. Here N, I, F and B are non-terminals. N is the starting non-terminal, and #, 0 and 1 are lexical tokens corresponding to input letters "#", "0" and "1", respectively. X.val denotes the synthesized attribute (a numeric value) associated with a non-terminal X. I$$_1$$ and F$$_1$$ denote occurrences of I and F on the right hand side of a production, respectively. For the tokens 0 and 1, 0.val = 0 and 1.val = 1.
$\begin{array}{llll}N & \rightarrow & I \# F & \text { N.val }=I . v a l+F . v a l \\ I & \rightarrow & I_1 B & I . v a l=\left(2 I_1 \cdot v a l\right)+\text { B.val } \\ I & \rightarrow & B & I . v a l=B . v a l \\ F & \rightarrow & B F_1 & F . v a l=\frac{1}{2}\left(B . v a l+F_1 \cdot v a l\right) \\ F & \rightarrow & B & F . v a l=\frac{1}{2} B . v a l \\ B & \rightarrow & 0 & \text { B.val }=\mathbf{0} . \mathrm{val} \\ B & \rightarrow & 1 & \text { B.val }=\mathbf{1} . \mathrm{val}\end{array}$The value computed by the translation scheme for the input string
$$10 \# 011$$
is ____________. (Rounded off to three decimal places)
Consider the following grammar along with translation rules.
S $$\to$$ S1 # T {S.val = S1.val * T.val}
S $$\to$$ T {S.val = T.val}
T $$\to$$ T1 %R {T.val = T1.val $$ \div $$ R.val}
T $$\to$$ R {T.val = R.val}
R $$\to$$ id {R.val = id.val}
Here # and % are operators and id is a token that represents an integer and id.val represents the corresponding integer value. The set of non-terminals is {S, T, R, P} and a subscripted non-terminal indicates an instance of the non-terminal. Using this translation scheme, the computed value of S.val for root of the parse tree for the expression 20#10%5#8%2%2 is ___________.
Consider the following grammar (that admits a series of declarations, followed by expressions) and the associated syntax directed translation (SDT) actions, given as pseudo-code:
P → D* E*
D → int ID {record that ID.lexeme is of type int}
D → bool ID { record that ID.lexeme is of type bool}
E → E1 + E2 {check that E1.type = E2.type = int; set E.type := int}
E → !E1 {check that E1.type = bool; set E.type := bool}
E → ID {set E.type := int}
With respect to the above grammar; which one of the following choices is correct?
$$S \to aA$$ $$\,\,\,\,\,$${ print $$1$$ }
$$S \to a$$ $$\,\,\,\,$$$$\,\,\,\,\,$${ print $$2$$ }
$$A \to Sb$$ $$\,\,\,\,\,$${ print $$3$$ }
Using the above $$SDTS,$$ the output printed by a bottom-up parser, for the input $$aab$$ is: