Consider the following grammar with corresponding synthesized attributes:
F → ⋅L {F.val = L.val}
L → LB {L.len = L.len + 1} {L.val = L.val+2 ^(-L.len)
× B.val}
L → B {L.len = 1, L.val = B.val/2}
B → 0 {B.val = 0}
B → 1 {B.val = 1}
If “F.val” gives the value of the binary fraction generated by F in above grammar then, the value of F.val on input {0.110} is _______. (Upto 3 decimal places)
Solution :
Doubt :
B.val = 0 ( red)
then how 0.875 ( yellow ) ?
wont it be :
0.75 + 2^-3 * 0 = 0.75 ?