A construct a translation scheme to enter the type of each


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 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 -+ TI 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 call procedure addtype to add the type of each identifier to its entry in the symbol table (pointed to by attribute entry).

Request for Solution File

Ask an Expert for Answer!!
Finance Basics: A construct a translation scheme to enter the type of each
Reference No:- TGS01477169

Expected delivery within 24 Hours