Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

1. Consider the following SDT for type declarations:...

Answered: 1 week ago