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

New Microsoft Word Document

Uploaded by

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

New Microsoft Word Document

Uploaded by

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

1 Seat No.: ________ Enrolment No.

___________ GUJARAT TECHNOLOGICAL UNIVERSITY BE -


SEMESTER–VII (NEW) EXAMINATION – WINTER 2023 Subject Code:3170701 Date:04-12-2023 Subject
Name: Compiler Design Time: 10:30 AM TO 01:00 PM Total Marks:70 Instructions: 1. Attempt all
questions. 2. Make suitable assumptions wherever necessary. 3. Figures to the right indicate full
marks. Simple and non-programmable scientific calculators are allowed Marks Q.1 (a) Explain the
role of linker, loader and preprocessor in the process of compilation. 03 (b) Define lexeme, token and
pattern. Identify the tokens from the following program segment void change (int c, int d) { int m; m
= c; c= d; d = m; } 04 (c) Explain the phases of compiler with an example. 07 Q.2 (a) Find the Regular
Expression corresponding to given statement subset of {0,1}* 1) The Language of all strings
containing exactly three 1’s 2) The Language of all strings begins or ends with 00 3) The Language of
all strings that contain at least three 1’s 03 (b) What is Left Recursion? Give an example for
eliminating the same 04 (c) Draw DFA for the following regular expression without construction of
NFA. ( a | b) * a (a | b)# 07 OR (c) Explain recursive-descent parsing with suitable example. 07 Q.3 (a)
Explain the stack implementation of shift reduce parser with the help of example. 03 (b) What is
inherited attribute? Explain with suitable example. 04 (c) Check the following grammar is SLR(1) or
not S → Aa | bAc | Bc | bBa A → d B → d 07 OR Q.3 (a) Define the following terms: 1) LL(1) Grammar
2) Ambiguous Grammar 3) Operator Grammar 03 (b) Find out FIRST & FOLLOW set for all the
Nonterminals S-> 1AB | ϵ A-> 1AC | 0C B-> 0S C-> 1 04 (c) Write a syntax directed definition for desk
calculator. Using this definition draw annotated parse tree for 6*3+5n 07 2 Q.4 (a) Explain Activation
Record 03 (b) Explain panic mode and phrase level error recovery techniques. 04 (c) Explain
quadruple, triple and indirect triple with suitable example. 07 OR Q.4 (a) Explain flow graph with
suitable example. 03 (b) Explain dynamic storage allocation techniques. 04 (c) Explain syntax directed
definition to produce three address codes for flow of control statements with suitable example. 07
Q.5 (a) Draw the parse tree and derive the left most derivation using the following grammar for the
input string: (a + a) * (a * a). E → E + T | T T → T * F | F F → ( E ) | a 03 (b) Write down the algorithm
for partitioning of basic blocks. 04 (c) Explain any four code optimization techniques with suitable
example. 07 OR Q.5 (a) Explain code scheduling constraints. 03 (b) Write short note on LEX. 04 (c)
Explain the generic issues in the design of code generators. 07 1 Seat No.: ________ Enrolment
No.___________ GUJARAT TECHNOLOGICAL UNIVERSITY BE - SEMESTER–VII (NEW) EXAMINATION –
WINTER 2022 Subject Code:3170701 Date:18-01-2023 Subject Name:Complier Design Time:10:30
AM TO 01:00 PM Total Marks:70 Instructions: 1. Attempt all questions. 2. Make suitable assumptions
wherever necessary. 3. Figures to the right indicate full marks. 4. Simple and non-programmable
scientific calculators are allowed. MARKS Q.1 (a) What is compiler? What is front-end and back-end
of compiler? 03 (b) Write a brief note on input buffering techniques. 04 (c) Explain input, output and
action performed by each phases of compiler with example. 07 Q.2 (a) Define Handle, Handle
pruning, Ambiguous grammar. 03 (b) Explain error recovery strategies. 04 (c) Define token, lexeme
and pattern. Identify the lexemes that makes up the tokens for the following code const p = 10; if( a <
p) { a++ ; If(a== 5) continue ; } 07 OR (c) Construct deterministic finite automata without constructing
NFA for following regular expression. (a/b)*abb*. 07 Q.3 (a) What is lexical analysis? Which are the
tasks performed by lexical analyzer. 03 (b) Give the rule to remove left recursive grammar. And
Eliminate left recursion from following grammar. S → Aa | b A → Ac | Sd | f 04 (c) Show the following
grammar is LR(1) but not LALR(1). S->Aa │bAc │Bc│bBa A->d B->d 07 OR Q.3 (a) Write RE the
following language.. 1. All string of 0’s and 1’s that do not contain 11. 2. All string of 0’s and 1’s that
every 1 is followed by 00 03 (b) What is left factoring in CFG? Perform the Left factoring of following
Grammar. S → iEtS / iEtSaS / a E → b 04 2 (c) Construct SLR parsing table for the following grammar :
S → (L) | a L→ L,S | S 07 Q.4 (a) Define : 1) synthesized attribute 2) inherited attribute 03 (b)
Construct syntax tree and DAG for following expression: X = a * (b+c)- (b+c)* d 04 (c) Give syntax
directed definition for simple desk calculator. Also show annotated parse tree for 6*5+7n, 07 OR Q.4
(a) Write a short note on Symbol table management. 03 (b) Explain dynamic memory allocation
strategy. 04 (c) Translate the expression –(a+b)*(c+d)*(a+b*c) into Quadruples, Triples, and Indirect
triples 07 Q.5 (a) Compare: Static v/s Dynamic Memory Allocation. 03 (b) Explain Activation Record.
04 (c) Explain any three code-optimization technique in detail. 07 OR Q.5 (a) Explain Basic Block and
Flow Graph with example. 03 (b) Explain various parameter passing methods. 04 (c) Explain various
issues in design of code generator. 07 ************* 1 Seat No.: ________ Enrolment
No.___________ GUJARAT TECHNOLOGICAL UNIVERSITY BE - SEMESTER–VII (NEW) EXAMINATION –
WINTER 2021 Subject Code:3170701 Date:22/12/2021 Subject Name:Complier Design Time:10:30
AM TO 01:00 PM Total Marks: 70 Instructions: 1. Attempt all questions. 2. Make suitable assumptions
wherever necessary. 3. Figures to the right indicate full marks. 4. Simple and non-programmable
scientific calculators are allowed. MARKS Q.1 (a) Define following terms: i. Compiler ii. Interpreter
iii.Token 03 (b) Explain activation tree? 04 (c) Explain a rule of Left factoring a grammar and give
Example. 07 Q.2 (a) Explain input buffering methods. 03 (b) Define the following terms and give
suitable example for it. i. Augmented Grammar ii. LR(0) Item iii.LR(1) Item 04 (c) Draw the DFA for the
regular expression (a|b)*abb using set construction method only. 07 OR (c) Draw NFA from regular
expression using Thomson’s construction and convert it into DFA. (a | b)* a b* a 07 Q.3 (a) Describe
Ambiguous Grammar with example. 03 (b) Design FIRST and FOLLOW set for the following grammar.
S→ 1AB | ε A→1AC | 0C B→0S C→1 04 (c) Explain operator grammar. Generate precedence function
table for following grammar. E -> EAE | id A -> + | * 07 OR Q.3 (a) Differentiate Top Down Parsing and
Bottom up parsing 03 (b) Explain error recovery strategies used by parser. 04 (c) Construct CLR
parsing table for following grammar. S -> aSA | € A -> bS | c 07 Q.4 (a) Explain various issues in design
of code generator. 03 (b) Explain the following parameter passing methods. 1. Call-by-value 2. Call-
by-reference 3. Copy-Restore 4. Call-by-Name 04 (c) Explain Peephole Optimization. 07 OR 2 Q.4 (a)
Draw a DAG for expression: a + a * (b – c) + (b – c) * d. 03 (b) Compare: Static v/s Dynamic Memory
Allocation. 04 (c) Translate following arithmetic expression - ( a * b ) + ( c + d ) - ( a + b + c + d ) into 1]
Quadruples 2] Triple 3] Indirect Triple 07 Q.5 (a) Explain symbol table. For what purpose , compiler
uses symbol table? 03 (b) Explain Basic-Block Scheduling. 04 (c) Explain synthesized attributes with
the help of an example. 07 OR Q.5 (a) Define a following: i. Basic block ii. Constant folding iii. Handle.
03 (b) Write difference(s) between stack and heap memory allocation. 04 (c) Explain Pass structure of
assembler. 07 ************ 1 Enrolment No./Seat No_____________ GUJARAT TECHNOLOGICAL
UNIVERSITY BE - SEMESTER–VII (NEW) EXAMINATION – SUMMER 2024 Subject Code:3170701
Date:17-05-2024 Subject Name:Compiler Design Time:02:30 PM TO 05:00 PM Total Marks:70
Instructions: 1. Attempt all questions. 2. Make suitable assumptions wherever necessary. 3. Figures
to the right indicate full marks. 4. Simple and non-programmable scientific calculators are allowed.
MARKS Q.1 (a) State the applications of language processors. 03 (b) Explain input buffering
techniques in brief. 04 (c) Explain cousins of compiler in detail. 07 Q.2 (a) Enlist types of compiler.
Explain any two in brief. 03 (b) Explain error recovery strategies in brief. 04 (c) Explain construction of
DFA from regular expression without making NFA with suitable example. 07 OR (c) Explain role of
lexical analyzer with example in compiler design process. 07 Q.3 (a) Explain basic block with example.
03 (b) Explain Syntax-Directed Definition with example. 04 (c) Explain LL (1) parsing technique with
suitable example. 07 OR Q.3 (a) Explain quadruple with example. 03 (b) Explain left recursion
removal algorithm with example. 04 (c) Explain LR (1) parsing technique with suitable example. 07
Q.4 (a) Give the difference between stack allocation and heap allocation of space. 03 (b) Explain
various techniques for intermediate code representation with example. 04 (c) Explain recursive
decent parsing technique with suitable example. 07 OR Q.4 (a) Compare various parameter passing
techniques for run time environment. 03 (b) Explain various techniques used to represent the three-
address code with example. 04 (c) Explain shift-reduce parsing technique with suitable example. 07
Q.5 (a) Write a short note on activation record. 03 (b) Explain basic-block scheduling in brief. 04 (c)
Describe various code optimization techniques with example. 07 OR Q.5 (a) Write a short note on
activation tree. 03 (b) Explain code scheduling constraints in brief. 04 (c) Describe various design
issues of a code generator. 07 ************* 1 Seat No.: ________ Enrolment No.___________
GUJARAT TECHNOLOGICAL UNIVERSITY BE – SEMESTER- VII EXAMINATION-SUMMER 2023 Subject
Code: 3170701 Date: 22/06/2023 Subject Name: Compiler Design Time: 10:30 AM TO 01:00 PM Total
Marks: 70 Instructions: 1. Attempt all questions. 2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks. 4. Simple and non-programmable scientific calculators are
al. MARKS Q.1 (a) Define lexemes, patterns and tokens 03 (b) Write a regular definition for: 1. The
language of all strings containing at least one 0 and at least one 1. 2. The language of all strings that
do not end with 01. 3. The language of all strings containing 0’s and 1’s both are even. 4. The
language of all strings which are starting with 1 and ending with 0. 04 (c) Explain phases of compilers
with suitable example. 07 Q.2 (a) Differentiate ambiguous and unambiguous grammar. 03 (b) Write a
short note on input buffering techniques. 04 (c) Construct a DFA for a given regular expression using
syntax tree with firstpos, lastpos and followpos function. (a|b)*a 07 OR (c) Construct the NFA for
following regular expression using Thompson’s construction. Apply subset construction method to
convert into DFA. (a+b)*abb# 07 Q.3 (a) Give the translation scheme that convert infix to postfix
notation. 03 (b) Define: Left Recursive Grammar. Check Following grammar is left recursive or not, if
yes, remove left recursive from it. A → ABd / Aa / a B → Be / b 04 (c) Construct an SLR Parsing table
for the following grammar. S  Aa | bAc | bBa A  d B  d 07 OR Q.3 (a) Explain shift reduce parsing
technique in brief. 03 (b) Differentiate top down parsing and bottom up parsing. 04 (c) Show that the
following grammar S  AaAb | BbBa A  ϵ B  ϵ is LL(1) but not SLR(1). 07 2 Q.4 (a) Write a short note
on activation record. 03 (b) Explain Symbol table management in brief. 04 (c) List and explain various
storage allocation strategies. 07 OR Q.4 (a) What do you mean by dangling references? 03 (b) Explain
Error Recovery Strategies in Compiler in brief. 04 (c) Write three address code for a = b*-c + b*-c 07
Q.5 (a) Translate the arithmetic expression (a + b) * (c + d) into 1. Syntax tree 2. Postfix notation 03
(b) Compare: Static v/s Dynamic Memory Allocation 04 (c) Explain various code optimization
techniques. 07 OR Q.5 (a) Construct a DAG for the following expression: a = b*-c + b*-c 03 (b) Explain
various parameter passing methods. 04 (c) Explain various issues in design of code generator. 07
************* 1 Seat No.: ________ Enrolment No.___________ GUJARAT TECHNOLOGICAL
UNIVERSITY BE - SEMESTER–VII (NEW) EXAMINATION – SUMMER 2022 Subject Code:3170701
Date:16/06/2022 Subject Name:Complier Design Time:02:30 PM TO 05:00 PM Total Marks: 70
Instructions: 1. Attempt all questions. 2. Make suitable assumptions wherever necessary. 3. Figures
to the right indicate full marks. 4. Simple and non-programmable scientific calculators are allowed.
MARKS Q.1 (a) Explain the roles of linker, loader and preprocessor. 03 (b) What is Input Buffering?
Why it is used? 04 (c) Explain the language dependent and machine independent phases of compiler.
Also List major functions done by compiler. 07 Q.2 (a) Describe the role of lexical analyzer. 03 (b)
Write the regular expression R over {0,1} or {a,b}: 1) The set of all strings with even number of a’s
followed by an odd number of b’s. 2) The set of all strings that consist of alternating 0’s and 1’s 04 (c)
Explain activation record in detail. 07 OR (c) What are conflicts in LR Parser? What are their types?
Explain with an example. 07 Q.3 (a) What do you mean by left recursion and how it is eliminated? 03
(b) What is ambiguous grammar? Show that S -> aS|Sa|a ia an ambiguous grammar. 04 (c) Consider
the following grammar: S’ = S# S -> ABC A -> a|bbD B -> a| Ꜫ C -> b| Ꜫ D -> c| Ꜫ Construct FIRST and
FOLLOW for the grammar also design LL(1) parsing table for the grammar 07 OR Q.3 (a) Differentiate
between top down parser and bottom up parser. 03 (b) Explain handle and handle pruning 04 (c)
Consider the following grammar S -> AA A -> aA A -> b And construct the LALR parsing table. 07 Q.4
(a) Differentiate between S attributes and L attributes 03 (b) For the following production write the
semantic action: 1. S -> E$ 04 2 2. E -> E1 + E2 3. E -> E1 * E2 4. E - > digit (c) Translate the following
expression into quadruple, triple, and indirect triple: -(a+b)*(c+d)-(a+b+c) 07 OR Q.4 (a) Differentiate
between parse tree and syntax tree 03 (b) What is dependency graph? Explain with example. 04 (c)
Generate the three address code for the following program segment: While(ad) Do if a=1 then c =
c+1 Else While a<=d Do a= a+b 07 Q.5 (a) List the issues in code generation. 03 (b) Discuss the
functions of error handler. 04 (c) What is DAG? What are its advantages in context of optimization?
How does it help in eliminating common sub expression? 07 OR Q.5 (a) What is global optimization?
Name the 2 types of analysis performed for global optimization. 03 (b) Explain the following with
example 1) Lexical phase error 2) Syntactic phase error 04 (c) What is peephole optimization? Explain
with example. 07 *************1 Seat No.: ________ Enrolment No.___________ GUJARAT
TECHNOLOGICAL UNIVERSITY BE - SEMESTER–VII (NEW) EXAMINATION – WINTER 2023 Subject
Code:3170701 Date:04-12-2023 Subject Name: Compiler Design Time: 10:30 AM TO 01:00 PM Total
Marks:70 Instructions: 1. Attempt all questions. 2. Make suitable assumptions wherever necessary. 3.
Figures to the right indicate full marks. Simple and non-programmable scientific calculators are
allowed Marks Q.1 (a) Explain the role of linker, loader and preprocessor in the process of
compilation. 03 (b) Define lexeme, token and pattern. Identify the tokens from the following program
segment void change (int c, int d) { int m; m = c; c= d; d = m; } 04 (c) Explain the phases of compiler
with an example. 07 Q.2 (a) Find the Regular Expression corresponding to given statement subset of
{0,1}* 1) The Language of all strings containing exactly three 1’s 2) The Language of all strings begins
or ends with 00 3) The Language of all strings that contain at least three 1’s 03 (b) What is Left
Recursion? Give an example for eliminating the same 04 (c) Draw DFA for the following regular
expression without construction of NFA. ( a | b) * a (a | b)# 07 OR (c) Explain recursive-descent
parsing with suitable example. 07 Q.3 (a) Explain the stack implementation of shift reduce parser
with the help of example. 03 (b) What is inherited attribute? Explain with suitable example. 04 (c)
Check the following grammar is SLR(1) or not S → Aa | bAc | Bc | bBa A → d B → d 07 OR Q.3 (a)
Define the following terms: 1) LL(1) Grammar 2) Ambiguous Grammar 3) Operator Grammar 03 (b)
Find out FIRST & FOLLOW set for all the Nonterminals S-> 1AB | ϵ A-> 1AC | 0C B-> 0S C-> 1 04 (c)
Write a syntax directed definition for desk calculator. Using this definition draw annotated parse tree
for 6*3+5n 07 2 Q.4 (a) Explain Activation Record 03 (b) Explain panic mode and phrase level error
recovery techniques. 04 (c) Explain quadruple, triple and indirect triple with suitable example. 07 OR
Q.4 (a) Explain flow graph with suitable example. 03 (b) Explain dynamic storage allocation
techniques. 04 (c) Explain syntax directed definition to produce three address codes for flow of
control statements with suitable example. 07 Q.5 (a) Draw the parse tree and derive the left most
derivation using the following grammar for the input string: (a + a) * (a * a). E → E + T | T T → T * F |
F F → ( E ) | a 03 (b) Write down the algorithm for partitioning of basic blocks. 04 (c) Explain any four
code optimization techniques with suitable example. 07 OR Q.5 (a) Explain code scheduling
constraints. 03 (b) Write short note on LEX. 04 (c) Explain the generic issues in the design of code
generators. 07 1 Seat No.: ________ Enrolment No.___________ GUJARAT TECHNOLOGICAL
UNIVERSITY BE - SEMESTER–VII (NEW) EXAMINATION – WINTER 2022 Subject Code:3170701
Date:18-01-2023 Subject Name:Complier Design Time:10:30 AM TO 01:00 PM Total Marks:70
Instructions: 1. Attempt all questions. 2. Make suitable assumptions wherever necessary. 3. Figures
to the right indicate full marks. 4. Simple and non-programmable scientific calculators are allowed.
MARKS Q.1 (a) What is compiler? What is front-end and back-end of compiler? 03 (b) Write a brief
note on input buffering techniques. 04 (c) Explain input, output and action performed by each
phases of compiler with example. 07 Q.2 (a) Define Handle, Handle pruning, Ambiguous grammar. 03
(b) Explain error recovery strategies. 04 (c) Define token, lexeme and pattern. Identify the lexemes
that makes up the tokens for the following code const p = 10; if( a < p) { a++ ; If(a== 5) continue ; } 07
OR (c) Construct deterministic finite automata without constructing NFA for following regular
expression. (a/b)*abb*. 07 Q.3 (a) What is lexical analysis? Which are the tasks performed by lexical
analyzer. 03 (b) Give the rule to remove left recursive grammar. And Eliminate left recursion from
following grammar. S → Aa | b A → Ac | Sd | f 04 (c) Show the following grammar is LR(1) but not
LALR(1). S->Aa │bAc │Bc│bBa A->d B->d 07 OR Q.3 (a) Write RE the following language.. 1. All string
of 0’s and 1’s that do not contain 11. 2. All string of 0’s and 1’s that every 1 is followed by 00 03 (b)
What is left factoring in CFG? Perform the Left factoring of following Grammar. S → iEtS / iEtSaS / a E
→ b 04 2 (c) Construct SLR parsing table for the following grammar : S → (L) | a L→ L,S | S 07 Q.4 (a)
Define : 1) synthesized attribute 2) inherited attribute 03 (b) Construct syntax tree and DAG for
following expression: X = a * (b+c)- (b+c)* d 04 (c) Give syntax directed definition for simple desk
calculator. Also show annotated parse tree for 6*5+7n, 07 OR Q.4 (a) Write a short note on Symbol
table management. 03 (b) Explain dynamic memory allocation strategy. 04 (c) Translate the
expression –(a+b)*(c+d)*(a+b*c) into Quadruples, Triples, and Indirect triples 07 Q.5 (a) Compare:
Static v/s Dynamic Memory Allocation. 03 (b) Explain Activation Record. 04 (c) Explain any three
code-optimization technique in detail. 07 OR Q.5 (a) Explain Basic Block and Flow Graph with
example. 03 (b) Explain various parameter passing methods. 04 (c) Explain various issues in design of
code generator. 07 ************* 1 Seat No.: ________ Enrolment No.___________ GUJARAT
TECHNOLOGICAL UNIVERSITY BE - SEMESTER–VII (NEW) EXAMINATION – WINTER 2021 Subject
Code:3170701 Date:22/12/2021 Subject Name:Complier Design Time:10:30 AM TO 01:00 PM Total
Marks: 70 Instructions: 1. Attempt all questions. 2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks. 4. Simple and non-programmable scientific calculators are
allowed. MARKS Q.1 (a) Define following terms: i. Compiler ii. Interpreter iii.Token 03 (b) Explain
activation tree? 04 (c) Explain a rule of Left factoring a grammar and give Example. 07 Q.2 (a) Explain
input buffering methods. 03 (b) Define the following terms and give suitable example for it. i.
Augmented Grammar ii. LR(0) Item iii.LR(1) Item 04 (c) Draw the DFA for the regular expression (a|
b)*abb using set construction method only. 07 OR (c) Draw NFA from regular expression using
Thomson’s construction and convert it into DFA. (a | b)* a b* a 07 Q.3 (a) Describe Ambiguous
Grammar with example. 03 (b) Design FIRST and FOLLOW set for the following grammar. S→ 1AB | ε
A→1AC | 0C B→0S C→1 04 (c) Explain operator grammar. Generate precedence function table for
following grammar. E -> EAE | id A -> + | * 07 OR Q.3 (a) Differentiate Top Down Parsing and Bottom
up parsing 03 (b) Explain error recovery strategies used by parser. 04 (c) Construct CLR parsing table
for following grammar. S -> aSA | € A -> bS | c 07 Q.4 (a) Explain various issues in design of code
generator. 03 (b) Explain the following parameter passing methods. 1. Call-by-value 2. Call-by-
reference 3. Copy-Restore 4. Call-by-Name 04 (c) Explain Peephole Optimization. 07 OR 2 Q.4 (a)
Draw a DAG for expression: a + a * (b – c) + (b – c) * d. 03 (b) Compare: Static v/s Dynamic Memory
Allocation. 04 (c) Translate following arithmetic expression - ( a * b ) + ( c + d ) - ( a + b + c + d ) into 1]
Quadruples 2] Triple 3] Indirect Triple 07 Q.5 (a) Explain symbol table. For what purpose , compiler
uses symbol table? 03 (b) Explain Basic-Block Scheduling. 04 (c) Explain synthesized attributes with
the help of an example. 07 OR Q.5 (a) Define a following: i. Basic block ii. Constant folding iii. Handle.
03 (b) Write difference(s) between stack and heap memory allocation. 04 (c) Explain Pass structure of
assembler. 07 ************ 1 Enrolment No./Seat No_____________ GUJARAT TECHNOLOGICAL
UNIVERSITY BE - SEMESTER–VII (NEW) EXAMINATION – SUMMER 2024 Subject Code:3170701
Date:17-05-2024 Subject Name:Compiler Design Time:02:30 PM TO 05:00 PM Total Marks:70
Instructions: 1. Attempt all questions. 2. Make suitable assumptions wherever necessary. 3. Figures
to the right indicate full marks. 4. Simple and non-programmable scientific calculators are allowed.
MARKS Q.1 (a) State the applications of language processors. 03 (b) Explain input buffering
techniques in brief. 04 (c) Explain cousins of compiler in detail. 07 Q.2 (a) Enlist types of compiler.
Explain any two in brief. 03 (b) Explain error recovery strategies in brief. 04 (c) Explain construction of
DFA from regular expression without making NFA with suitable example. 07 OR (c) Explain role of
lexical analyzer with example in compiler design process. 07 Q.3 (a) Explain basic block with example.
03 (b) Explain Syntax-Directed Definition with example. 04 (c) Explain LL (1) parsing technique with
suitable example. 07 OR Q.3 (a) Explain quadruple with example. 03 (b) Explain left recursion
removal algorithm with example. 04 (c) Explain LR (1) parsing technique with suitable example. 07
Q.4 (a) Give the difference between stack allocation and heap allocation of space. 03 (b) Explain
various techniques for intermediate code representation with example. 04 (c) Explain recursive
decent parsing technique with suitable example. 07 OR Q.4 (a) Compare various parameter passing
techniques for run time environment. 03 (b) Explain various techniques used to represent the three-
address code with example. 04 (c) Explain shift-reduce parsing technique with suitable example. 07
Q.5 (a) Write a short note on activation record. 03 (b) Explain basic-block scheduling in brief. 04 (c)
Describe various code optimization techniques with example. 07 OR Q.5 (a) Write a short note on
activation tree. 03 (b) Explain code scheduling constraints in brief. 04 (c) Describe various design
issues of a code generator. 07 ************* 1 Seat No.: ________ Enrolment No.___________
GUJARAT TECHNOLOGICAL UNIVERSITY BE – SEMESTER- VII EXAMINATION-SUMMER 2023 Subject
Code: 3170701 Date: 22/06/2023 Subject Name: Compiler Design Time: 10:30 AM TO 01:00 PM Total
Marks: 70 Instructions: 1. Attempt all questions. 2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks. 4. Simple and non-programmable scientific calculators are
al. MARKS Q.1 (a) Define lexemes, patterns and tokens 03 (b) Write a regular definition for: 1. The
language of all strings containing at least one 0 and at least one 1. 2. The language of all strings that
do not end with 01. 3. The language of all strings containing 0’s and 1’s both are even. 4. The
language of all strings which are starting with 1 and ending with 0. 04 (c) Explain phases of compilers
with suitable example. 07 Q.2 (a) Differentiate ambiguous and unambiguous grammar. 03 (b) Write a
short note on input buffering techniques. 04 (c) Construct a DFA for a given regular expression using
syntax tree with firstpos, lastpos and followpos function. (a|b)*a 07 OR (c) Construct the NFA for
following regular expression using Thompson’s construction. Apply subset construction method to
convert into DFA. (a+b)*abb# 07 Q.3 (a) Give the translation scheme that convert infix to postfix
notation. 03 (b) Define: Left Recursive Grammar. Check Following grammar is left recursive or not, if
yes, remove left recursive from it. A → ABd / Aa / a B → Be / b 04 (c) Construct an SLR Parsing table
for the following grammar. S  Aa | bAc | bBa A  d B  d 07 OR Q.3 (a) Explain shift reduce parsing
technique in brief. 03 (b) Differentiate top down parsing and bottom up parsing. 04 (c) Show that the
following grammar S  AaAb | BbBa A  ϵ B  ϵ is LL(1) but not SLR(1). 07 2 Q.4 (a) Write a short note
on activation record. 03 (b) Explain Symbol table management in brief. 04 (c) List and explain various
storage allocation strategies. 07 OR Q.4 (a) What do you mean by dangling references? 03 (b) Explain
Error Recovery Strategies in Compiler in brief. 04 (c) Write three address code for a = b*-c + b*-c 07
Q.5 (a) Translate the arithmetic expression (a + b) * (c + d) into 1. Syntax tree 2. Postfix notation 03
(b) Compare: Static v/s Dynamic Memory Allocation 04 (c) Explain various code optimization
techniques. 07 OR Q.5 (a) Construct a DAG for the following expression: a = b*-c + b*-c 03 (b) Explain
various parameter passing methods. 04 (c) Explain various issues in design of code generator. 07
************* 1 Seat No.: ________ Enrolment No.___________ GUJARAT TECHNOLOGICAL
UNIVERSITY BE - SEMESTER–VII (NEW) EXAMINATION – SUMMER 2022 Subject Code:3170701
Date:16/06/2022 Subject Name:Complier Design Time:02:30 PM TO 05:00 PM Total Marks: 70
Instructions: 1. Attempt all questions. 2. Make suitable assumptions wherever necessary. 3. Figures
to the right indicate full marks. 4. Simple and non-programmable scientific calculators are allowed.
MARKS Q.1 (a) Explain the roles of linker, loader and preprocessor. 03 (b) What is Input Buffering?
Why it is used? 04 (c) Explain the language dependent and machine independent phases of compiler.
Also List major functions done by compiler. 07 Q.2 (a) Describe the role of lexical analyzer. 03 (b)
Write the regular expression R over {0,1} or {a,b}: 1) The set of all strings with even number of a’s
followed by an odd number of b’s. 2) The set of all strings that consist of alternating 0’s and 1’s 04 (c)
Explain activation record in detail. 07 OR (c) What are conflicts in LR Parser? What are their types?
Explain with an example. 07 Q.3 (a) What do you mean by left recursion and how it is eliminated? 03
(b) What is ambiguous grammar? Show that S -> aS|Sa|a ia an ambiguous grammar. 04 (c) Consider
the following grammar: S’ = S# S -> ABC A -> a|bbD B -> a| Ꜫ C -> b| Ꜫ D -> c| Ꜫ Construct FIRST and
FOLLOW for the grammar also design LL(1) parsing table for the grammar 07 OR Q.3 (a) Differentiate
between top down parser and bottom up parser. 03 (b) Explain handle and handle pruning 04 (c)
Consider the following grammar S -> AA A -> aA A -> b And construct the LALR parsing table. 07 Q.4
(a) Differentiate between S attributes and L attributes 03 (b) For the following production write the
semantic action: 1. S -> E$ 04 2 2. E -> E1 + E2 3. E -> E1 * E2 4. E - > digit (c) Translate the following
expression into quadruple, triple, and indirect triple: -(a+b)*(c+d)-(a+b+c) 07 OR Q.4 (a) Differentiate
between parse tree and syntax tree 03 (b) What is dependency graph? Explain with example. 04 (c)
Generate the three address code for the following program segment: While(ad) Do if a=1 then c =
c+1 Else While a<=d Do a= a+b 07 Q.5 (a) List the issues in code generation. 03 (b) Discuss the
functions of error handler. 04 (c) What is DAG? What are its advantages in context of optimization?
How does it help in eliminating common sub expression? 07 OR Q.5 (a) What is global optimization?
Name the 2 types of analysis performed for global optimization. 03 (b) Explain the following with
example 1) Lexical phase error 2) Syntactic phase error 04 (c) What is peephole optimization? Explain
with example. 07 *************

You might also like