Question: Write an attribute grammar based on the CFG of Figure 4.11 that will build a syntax tree with the structure described in Figure 4.14. Figure
Write an attribute grammar based on the CFG of Figure 4.11 that will build a syntax tree with the structure described in Figure 4.14.
Figure 4.11:

Figure 4.14:

program stmt list $$ stmt list + stmt list decl | stmt list stmt | e decl int id real id stmt id := expr | read id write expr + term | expr add op term factor | term mult op factor xpr term factor + ( expr ) | id | int_const | real_const | float ( expr ) | trunc ( expr ) add-op +| - * | / mult_op
Step by Step Solution
3.44 Rating (160 Votes )
There are 3 Steps involved in it
ANSWER Class of node program stmtlist decl stmt expr term factor Variants intdecl realdecl read writ... View full answer
Get step-by-step solutions from verified subject matter experts
