Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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;
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

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

Step: 2

blur-text-image

Step: 3

blur-text-image

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