Question: Design a class hierarchy to represent syntax trees for the CFG of Figure 4.5. Provide a method in each class to return the value of

 Design a class hierarchy to represent syntax trees for the CFG

Design a class hierarchy to represent syntax trees for the CFG of Figure 4.5. Provide a method in each class to return the value of a node. Provide constructors that play the role of the make_leaf, make_un_op, and make_bin_op subroutines. E1E2+T - E1ptr:= make_bin_op("+", E2.ptr,T.ptr) E1E2T - E1.ptr:= make_bin_op("-" 2, E2 ptr, T.ptr) ET - E.ptr :=T.ptr T1T2F - T1,ptr:= make_bin_op( " ", T2.ptr, F.ptr) T1T2/F - T1, ptr : = make_bin_op( " ",T2.ptr, F.ptr) TF - T.ptr := F.ptr F1F2 - F1,ptr:= make_un_op("+/_", F2,ptr) F(E) - F.ptr := E.ptr F const - F.ptr := make_eaf(const.val)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!