Question: 1. Consider the following SDT for type declarations: PMDM{offset=0;}DTid;{top.put(id.lexeme,T.type,offset);offset=offset+T.width;}DTrecord}{Env.push(top);top=newEnv();Stack.push(offset);offset=0;}D}{T.type=record(top);T.width=offset;top=Env.pop();offset=Stack.pop();}TB{t=B.type;w=B.width;}Bint{T.type=C.type;T.width=C.width}Bfloat{B.type=float;B.width=8;}C{C.type=t;C.width=w;}C[num]C1{C.type=array(num.value,C1.type);C.width=num.valueC1.width;} Fig 1: SDT for type declaration a. Determine the types and relative addresses for the identifiers


1. Consider the following SDT for type declarations: PMDM{offset=0;}DTid;{top.put(id.lexeme,T.type,offset);offset=offset+T.width;}DTrecord}{Env.push(top);top=newEnv();Stack.push(offset);offset=0;}D}{T.type=record(top);T.width=offset;top=Env.pop();offset=Stack.pop();}TB{t=B.type;w=B.width;}Bint{T.type=C.type;T.width=C.width}Bfloat{B.type=float;B.width=8;}C{C.type=t;C.width=w;}C[num]C1{C.type=array(num.value,C1.type);C.width=num.valueC1.width;} Fig 1: SDT for type declaration a. Determine the types and relative addresses for the identifiers in the following declaration by drawing the annotated parse tree and evaluating the attribute values of each non- terminal of the SDT: record { float [2][3]a; int b;}p
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
