Question: Consider the following CFG for floating point constants, without exponential notation. (Note that this exercise is somewhat artificial: the language in question is regular, and
Consider the following CFG for floating point constants, without exponential notation. (Note that this exercise is somewhat artificial: the language in question is regular, and would be handled by the scanner of a typical compiler.)
C -> digits . digits
Digits -> digit more_digits
more_digits -> digits |
digit -> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
Augment this grammar with attribute rules that will accumulate the value of the constants into a val attribute of the root of the root of the parse tree. Your answer should be S attributed.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
