NAT · 2 marks · Syntax Directed Translation

GATE CS 2023 CS — Q60

Consider the syntax directed translation given by the following grammar and semantic rules. Here N,I,FN, I, F and BB are non-terminals. NN is the starting non-terminal, and #, 0 and 1 are lexical tokens corresponding to input letters "#", "0" and "1", respectively. X.valX.val denotes the synthesized attribute (a numeric value) associated with a non-terminal XX. I1I_1 and F1F_1 denote occurrences of II and FF on the right hand side of a production, respectively. For the tokens 0 and 1, 0.val=00.val = 0 and 1.val=11.val = 1.

<br>N→I#FN.val=I.val+F.val<br>I→I1BI.val=(2×I1.val)+B.val<br>I→BI.val=B.val<br>F→BF1F.val=12(B.val+F1.val)<br>F→BF.val=12B.val<br>B→0B.val=0.val<br>B→1B.val=1.val<br>\begin{align*}<br>N & \to I \# F && N.val = I.val + F.val \\<br>I & \to I_1 B && I.val = (2 \times I_1.val) + B.val \\<br>I & \to B && I.val = B.val \\<br>F & \to B F_1 && F.val = \frac{1}{2}(B.val + F_1.val) \\<br>F & \to B && F.val = \frac{1}{2} B.val \\<br>B & \to 0 && B.val = 0.val \\<br>B & \to 1 && B.val = 1.val<br>\end{align*}

The value computed by the translation scheme for the input string
10#01110\#011
is ____________. (Rounded off to three decimal places)