Let synthesized attribute val give the value of the binary number generated by S in the following grammar. For example, on input 101.101. S.val = 5.625

a) Use synthesized attributes to determine S.val.
b) Determine S.val with a syntax-directed definition in which the only synthesized attribute of B is c, giving the contribution of the bit generated by B to the final value. For example. the contribution of the first and last bits in 101. 101 to the value 5.625 is 4 and 0.125. respectively.