Subject Code: 2170701
GUJARAT TECHNOLOGICAL UNIVERSITY
--- Content provided by FirstRanker.com ---
BE - SEMESTER-VII(NEW) EXAMINATION - SUMMER 2019Subject Name: Compiler Design
Date: 10/05/2019
Time: 02:30 PM TO 05:00 PM
Total Marks: 70
--- Content provided by FirstRanker.com ---
Instructions:
- Attempt all questions.
- Make suitable assumptions wherever necessary.
- Figures to the right indicate full marks.
Q.1 (a) Define lexemes, patterns and tokens. [03]
--- Content provided by FirstRanker.com ---
(b) Differentiate compilers and interpreters. [04](c) Explain analysis of source program for compilers. [07]
Q.2 (a) Give regular definition for signed and unsigned numbers. [03]
(b) Check whether the following grammar is ambiguous or not. [04]
S=>(S)S
--- Content provided by FirstRanker.com ---
S->e(c) Draw DFA from regular expression without constructing NFA. [07]
(a|b|c)*a(b|c)* #
OR
(c) Draw NFA from regular expression using Thomson’s construction and convert it into DFA. [07]
--- Content provided by FirstRanker.com ---
(a|b)*ab*aQ.3 (a) Define handle and handle pruning. [03]
(b) Construct operator precedence relations table for following grammar. [04]
E-> E+E
E-> E-E
--- Content provided by FirstRanker.com ---
E-> E*EE-> (E)
E->id
Assume suitable operator associativity and precedence.
(c) Construct recursive descent parser for following grammar. [07]
--- Content provided by FirstRanker.com ---
E->TAA->+TA
A->e
T->FB
B->*FB
--- Content provided by FirstRanker.com ---
B->eF-> (E)
F->id
OR
--- Content provided by FirstRanker.com ---
Q.3 (a) Differentiate top down parsing and bottom up parsing. [03]
(b) Construct syntax directed translation scheme for infix to postfix conversion. [04]
(c) Construct LL(1) parsing table for following grammar. Check whether the grammar is LL(1) or not. [07]
A->AaB
A->x
--- Content provided by FirstRanker.com ---
B->BCbB->Cy
C->Cc
C->e
--- Content provided by FirstRanker.com ---
Q.4 (b) Construct LR(0) item sets for following grammar. [04]
S -> AaAb
S -> BbBa
A->e
B->e
--- Content provided by FirstRanker.com ---
(c) Explain various error recovery schemes in detail. [07]OR
Q.4 (a) Differentiate LR(1) and LALR(1) parsers. [03]
(b) Construct syntax tree and DAG for following expression. [04]
--- Content provided by FirstRanker.com ---
a=(b+c+d) * (b+c-d) + a(c) Explain quadruples, triples and indirect triples with examples. [07]
Q.5 (a) Define basic block with a simple example. [03]
(b) Explain activation record. [04]
(c) Explain various methods of peephole optimization. [07]
--- Content provided by FirstRanker.com ---
ORQ.5 (a) Explain static storage allocation. [03]
(b) Explain any two parameter passing methods. [04]
(c) Explain various issues in design of code generator. [07]
--- Content provided by FirstRanker.com ---
This download link is referred from the post: GTU BE 2019 Summer Question Papers || Gujarat Technological University
--- Content provided by FirstRanker.com ---