Suppose declarations are generated by the following grammar.
a) Construct a translation scheme to enter the type of each identifier into the symbol table. as in Example 5.3
b) Construct a predictive translator from the translation scheme in (a)
Example 5.3 A declaration generated by the nonterminal D in the syntaxdirected definicion in Fig. 5.4 consists of the keyword int or real. followed by a list of identifiers . The nonterminal T has a synthesized attribute type , whose value is determ ined by the keyword in the declaration . The semantic ruleL.in := T. type I associated with production D -+ TL I sets inherited attribute L.in to the type in the declaration. The rules then pass this type down the parse tree using the inherited attribute Liin. Rules associated with 'he productions for L call procedure addtype to add the type of each identifier to its entry in the symbol table (pointed to by attribute entry).