Download GTU B.Tech 2020 Winter 7th Sem 2170701 Compiler Design Question Paper

Download GTU (Gujarat Technological University Ahmedabad) B.Tech/BE (Bachelor of Technology/ Bachelor of Engineering) 2020 Winter 7th Sem 2170701 Compiler Design Previous Question Paper

Seat No.: ________
Enrolment No.___________
GUJARAT TECHNOLOGICAL UNIVERSITY
BE- SEMESTER?VII (NEW) EXAMINATION ? WINTER 2020
Subject Code:2170701 Date:19/01/2021
Subject Name:Compiler Design
Time:10:30 AM TO 12:30 PM Total Marks: 56
Instructions:
1. Attempt any FOUR questions out of EIGHT questions.

2. Make suitable assumptions wherever necessary.

3. Figures to the right indicate full marks.


MARKS
Q.1 (a) Compare and contrast compilers and interpreters.
03

(b) Write a short note on LEX Tool.
04

(c) Explain phases of compilers with suitable example.
07
Q.2 (a) Define terms: pattern, lexeme, token
03

(b) Write any one method used in lexical analyzer for buffering the input.
04

(c) Construct nondeterministic finite automata by using Thomson's
07
Construction for following regular expression. Show the sequence of moves
made in processing the input string ababbab.
(a|b)* abb




Q.3 (a) Consider the following grammar to construct leftmost and right most
03
derivation for the sentence abab.
SaSbS|bSaS|

(b) Write rule(s) to check grammar is left recursive or not. Remove left
04
recursive from the following grammar.
SaBDh
BBb|c
DEF
Eg|
Ff|

(c) Construct the SLR parsing table for the following Grammar.
07
E E+T | T
T T*F | F
F (E) | id






Q.4 (a) Write rule(s) to check grammar is operator grammar or not.
03

(b) Explain any two error-recovery strategies.
04

(c) Construct LALR parsing table for the following grammar.
07
S -> CC
C -> cC
C -> d
1


Q.5 (a) Define : 1) synthesized attribute 2) inherited attribute
03

(b) Explain any two parameter passing methods.
04

(c) Write SDD for arithmetic expression and Construct annotated parse tree for
07
the input expression (4*7+1)*2 .



Q.6 (a) What is activation record?
03

(b) What is Intermediate form of the code? What are the advantages of it?
04

(c) Construct syntax directed translation scheme and definition that translate
07
arithmetic operation from infix to postfix in which an operator appears
before its operand as for example xy- is a positive notation for x-y . Give
annotated parse tree for the input 9-5+2 and 9-5*2.
Q.7 (a) Explain any two issues in design of code generator
03

(b) Compare: static v/s dynamic Memory Allocation.
04

(c) Translate the expression ?(a+b)*(c+d)+(a+b+c) into
07
1. Quadruples 2. Triples 3. Indirect triples



Q.8 (a) What are the limitations of static storage allocation?
03
(b) Write a short note on Symbol table management.
04
(c) Write any two methods of code-optimization in detail.
07

*************
2

This post was last modified on 04 March 2021