Gujarat Technological UniversitySummer 2026 Examination

GTU 3170701 Compiler Design (CD) Summer 2026 Paper Solution & PDF

B.E. · Computer Engineering · Semester 7 · Subject Code: 3170701
Download Official GTU PDF
Share:
Total Marks70 MarksExternal theory exam
Passing Marks23 Marks33% minimum cutoff
Exam Duration2.5 Hours2:30 PM – 5:00 PM
Paper Structure5 QuestionsWith internal OR choices
Jump toQ1Q2Q3Q4Q5

Question 1

14 MarksMedium
(a)
List the cousins of compiler and explain cross-compiler.
3 Marks
(b)
Explain Indirect Left Recursion with proper example.
4 Marks
(c)

Describe the role of the symbol table in relation to the six phases of a compiler.

7 Marks

Question 2

14 MarksMedium
(a)
Explain input buffering methods.
3 Marks
(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
4 Marks
(c)

Draw NFA from regular expression using Thomson’s construction and convert it into DFA. (a | b)* a b b.

7 Marks
OR OPTION
(c)
Implement the following grammar using Recursive Descent Parser.
S -> Aa | bAc | bBa
A -> d
B -> d
7 Marks

Question 3

14 MarksMedium
(a)
What is an ambiguous grammar?
Show that S → if E then S | if E then S else S | other is an ambiguous
grammar.
3 Marks
(b)
Explain Shift-Reduce parser with proper example.
4 Marks
(c)
Generate canonical parsing table for following augmented grammar.
S’->S
S->CC
C->Cc/d.
7 Marks
OR OPTION
(a)
Differentiate Top Down Parsing and Bottom up parsing.
3 Marks
(b)
Generate LR(0) Item set for
S → AA
A → aA | b
4 Marks
(c)
Explain rules to satisfy operator grammar. Generate precedence function table
for following grammar.
E -> ESE | id
S -> + | *
7 Marks

Question 4

14 MarksMedium
(a)
What is inherited attribute? Explain with suitable example.
3 Marks
(b)
Explain error recovery strategies.
4 Marks
(c)

Translate following arithmetic expression

  • ( a * b ) + ( c + d ) - ( a + b + c + d ) into
1Quadruples 2. Triple
3Indirect Triple
7 Marks
OR OPTION
(a)
Write a short note on activation record.
3 Marks
(b)
Explain Peephole Optimization.
4 Marks
(c)

Give syntax directed definition for simple desk calculator. Also show annotated parse tree for 6*5+7n.

7 Marks

Question 5

14 MarksMedium
(a)

Explain copy propagation and dead code elimination with respect to loop optimization.

3 Marks
(b)
Define a following:
1Basic block
2Constant folding
3Viable Prefix
4 Marks
(c)
Describe code generator design issues.
7 Marks
OR OPTION
(a)
Compare: Static v/s Dynamic Memory Allocation
3 Marks
(b)
Explain parameter passing techniques for procedure.
4 Marks
(c)

What is DAG? What are its advantages in context of optimization? How does it help in eliminating common sub expression?

7 Marks
College Exam Groups

Studying for Compiler Design?

Circulate this solved paper with KaTeX formulas and 1-click AI step solvers to your batchmates on WhatsApp or Telegram.

About this Examination Paper & Attribution

Official Gujarat Technological University (GTU) examination paper and step-by-step solutions for Compiler Design (CD) (Summer 2026, B.E. · Computer Engineering, Sem 7). Features complete 70-mark regular & remedial examination pattern, official marking distribution across all 5 questions, and direct 1-click official PDF download.

Transcribed for student exam preparation from Gujarat Technological University official examination archives. Questions, syllabus guidelines, and curriculum marking schemes remain the intellectual property of Gujarat Technological University.

Download PDF