Search for question
Question

:) Consider the grammar below for floating point numbers:

(20pt) Using the above grammar, write an attribute grammar which contains an attribute val that stores the value of a number such that the val of any internal node is the sum of the val's of its children. Besides the val attribute, you can use only one other attribute. The grammar does not have to be L-attributed. (10pt) Draw the annotated parse tree for the string 12.34. Show the attribute flow (arrows and values).

Fig: 1

Fig: 2

Fig: 3

Fig: 4