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

Compiler Design

The document outlines the 7th Semester B.Tech. End Term Examination for Compiler Design at the Silicon Institute of Technology, detailing the structure of the exam, including various questions on tokens, parsing, grammar, and compiler phases. It includes sections requiring definitions, programming tasks, and theoretical explanations related to compiler design concepts. The exam is designed to assess students' understanding of key topics in compiler design, with a total duration of 3 hours and full marks of 60.

Uploaded by

pub1jafulen2
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)
52 views3 pages

Compiler Design

The document outlines the 7th Semester B.Tech. End Term Examination for Compiler Design at the Silicon Institute of Technology, detailing the structure of the exam, including various questions on tokens, parsing, grammar, and compiler phases. It includes sections requiring definitions, programming tasks, and theoretical explanations related to compiler design concepts. The exam is designed to assess students' understanding of key topics in compiler design, with a total duration of 3 hours and full marks of 60.

Uploaded by

pub1jafulen2
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

Silicon Institute of Technology

Silicon Hills, Bhubaneswar


| An Autonomous Institute |

7th Semester B.Tech. End Term Examination 2022-23


COMPILER DESIGN(18CS2T33)
Duration: 03:00 Full Marks: 60

1 Answer All
a Define TOKEN, PATTERN and LEXEM.
1
b Find the tokens in the following C statements:
1
if ( a <= b )
C=d;
else
C = 5;
c What are the precedence and associative rules of the operators in the following grammar:
1
E-> E * F | F + E | F,
F->F – F | id
d Define handle. What is handle pruning ?
1
e Define Synthesized attributes and Inherited attributes.
1
f What are the difficulties with Top-down parsing ?
1
g Define Back-patching.
1
h Differentiate between L-attributed and S-attributed grammar.
1
i What is dead code elimination?
1
j Describe various data structures used for implementing symbol table and their respective
1
time complexity for LOOK_UP operation.
2 Answer All
a Write a LEX program to recognise multiple line comment in a C program.
3
b Compute FIRST and FOLLOW for all non terminals in the following grammar:
3
E-> TE'
E' → +TE' | ε
T → FT'
T' → *FT' | ε
F → (E) | id
c Write the algorithm to compute CLOSURE of a set I of LR(0) items.
3
d Construct the syntax tree and draw the DAG for the expression
3
(a * b) + (c - d) * (a * b) + b.
e What is strength reduction? Explain with an example.
3
[P. T. O.]
3 Answer any One
a Design Transition diagram to recognize identifier, single and multiple line comment, and
7
relational operators in C programming language.
b Describe various phases of compiler with a suitable example and a neat diagram.
7

4 Answer any One


a Construct the precedence relation table for the following grammar using LEADING and
7
TRAILING function:
E → E+T | T
T → T*F | F
F → (E) | id
b Test whether the following grammar is LL(1) or not and by constructing a predictive
7
parsing table for it:
S → iCtSS' | a
S' → eS | ϵ
C→ b
5 Answer any One
a Construct SLR parsing table for the grammar to test wheather or not the grammar is
7
SLR(1).
S→ L=R
S→ R
L → *R
L → id
R→ L
b Consider the syntax directed definition shown below.
7
S → id : = E {gen (id.place = E.place;);}
E → E1 + E2 {t = newtemp ( ); gen (t = El.place + E2.place;); E.place = t}
E → id {E.place = id.place;}
Here, gen is a function that generates the output code, and newtemp is a function that
returns the name of a new temporary variable on every call. Assume that ti's are the
temporary variable names generated by newtemp. For the statement 'X: = A + Y + Z', draw
the annotated syntax tree and write the 3-address code sequence generated by this
definitions.
6 Answer any One
a Given CFG
7
E→ E+T
E→ E - T
E→ T
T→ ( E )
T→ id
T→ num
Define the SDD to produce DAG and write the steps to produce DAG for expression " a +
a* (b-c) "
b What are the various intermediate forms? Mention its types. How would you implement the
7
three address statements? Generate intermediate code for the following program fragment.
Assume there are four bytes per word:
sum=0;
for(i=1;i<=20;i++)
sum = sum + a[i] + b[i];
7 Answer any One
a Write short note on:
7
( i ) Symbol Table
(ii) Run-time enviorment
(iii) Control Flow Graph
b What is machine independent code optimization? What are the different techniques used for
7
it ? Discuss with example.

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