0% found this document useful (0 votes)
8 views3 pages

Cse420 Final Question Fall'24 Set B

This document outlines the final examination for the CSE 420: Compiler Design course at BRAC University for Fall 2024. It includes four questions that require students to draw annotated parse trees, evaluate expressions, and explain the workings of Syntax Directed Translation (SDT). The exam is designed to assess students' understanding of compiler design concepts and their practical application.

Uploaded by

SHAHED ABDULLAH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Cse420 Final Question Fall'24 Set B

This document outlines the final examination for the CSE 420: Compiler Design course at BRAC University for Fall 2024. It includes four questions that require students to draw annotated parse trees, evaluate expressions, and explain the workings of Syntax Directed Translation (SDT). The exam is designed to assess students' understanding of compiler design concepts and their practical application.

Uploaded by

SHAHED ABDULLAH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

BRAC UNIVERSITY

Department of Computer Science and Engineering

Examination: Final Semester: Fall 2024


Duration: 1 Hour 20 Minutes Set - B Full Marks: 40

CSE 420: Compiler Design


Figures in the right margin indicate marks.
Answer all the questions
COs Questions Marks

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:

float [4] [5] x; record {int a; float b;} y; int z;

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 ;

Note: Here new Temp() creates an instance of compiler generated temporary


variables which is ‘t’ with a subscript 1, 2, 3 and so on. For example, the first
time an instance is created it will create t1, next time it is called it will create t2
and so on. Furthermore, the newLabel() method creates a label which is ‘L:’
with a subscript that follows similar logic as the temporary variable, for
example, L1:, L2: and so on.

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.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy