Question: Consider the following S D T for type declarations: P M D M l o n , { offset = 0 ; } D T

Consider the following SDT for type declarations:
PMD
Mlon,{ offset =0;}
DTid ; {top.put(id.lexeme, T.type, offset);
offset = offset +T. width ;}
Dlon
T record '{'{Env.push(top); top = new Env();
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 ;}
C
{T.type =C.type ; T. width =C. width; }
B int
{B.type = integer ; B.width =4;}
B float
{B.type = float ; B.width =8;}
Clon
{C.type =t; C.width =w;}
C[
um]C1
{C.type=array(num.value,C1*type);
C.width {:= num.value C1.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;
 Consider the following SDT for type declarations: PMD Mlon,{ offset =0;}

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!