Cse420 Final Question Fall'24 Set B
Cse420 Final Question Fall'24 Set B
C05 1. Consider the following SDD. Draw the Annotated Parse Tree and Evaluate it for 10
the String: ( ( a > b ) && ( c > d ) ) || ( ( w < x ) && ( y < z ) )
Note: Here newLabel() method creates a label which is ‘L:’ with a subscript 1,
2, 3 and so on. For example, the first time the method is called it will create
L1:, next time it is called it will create L2: and so on.
CO4 2. Consider the following SDT. Draw the Annotated Parse Tree and Evaluate the 15
values of the attributes type and width along with variable offset next to the
appropriate non-terminal nodes for the following String:
Afterwards draw the memory diagram along with actual location and data
Note: Offsets are given in decimal. Memory location is also given in decimal.
Every memory unit is of 1 byte. The width of int and float is also given in byte
in the SDT. The variable memory_addr refers to the starting position of the
memory address where the variables will be stored.
SDT:
Example of Memory Diagram for String: int v1; record {int y1; float y2; } v2;
where memory_addr = 021871; in the SDT.
C05 3. Consider the following SDD. Draw the Annotated Parse Tree and Evaluate it for 10
the String: if ( a > b ) a = c + d ; else a = a + b ;
C04 4. Explain the workings of SDT. Furthermore, explain why we use SDT. You are free 5
to use a small example to clarify your explanation if necessary.