0% found this document useful (0 votes)
23 views

Compiler design-BE-WINTER-2020

This document outlines an exam for a Compiler Design course. It contains 8 questions testing various compiler concepts like lexical analysis, parsing, syntax analysis, code generation and optimization. The questions cover topics such as finite automata, grammars, parsing techniques, attribute grammars, intermediate code representations, memory allocation and symbol tables.

Uploaded by

Ankita Ashal
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)
23 views

Compiler design-BE-WINTER-2020

This document outlines an exam for a Compiler Design course. It contains 8 questions testing various compiler concepts like lexical analysis, parsing, syntax analysis, code generation and optimization. The questions cover topics such as finite automata, grammars, parsing techniques, attribute grammars, intermediate code representations, memory allocation and symbol tables.

Uploaded by

Ankita Ashal
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/ 2

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.

SaSbS|bSaS|ε

(b) Write rule(s) to check grammar is left recursive or not. Remove left 04
recursive from the following grammar.
SaBDh
BBb|c
DEF
Eg| ε
Ff| ε

(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

*************

You might also like