This document contains a compiler construction exam for a 7th semester BE Computer Science and Engineering student, to be held on September 26th, 2022 for 2 hours with 5 questions worth a total of 35 marks and weighing 25% of the course. The exam will be proctored by 5 faculty members and requires the student to answer all questions with proper justification, assuming any missing data.
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 ratings0% found this document useful (0 votes)
44 views
UCS802
This document contains a compiler construction exam for a 7th semester BE Computer Science and Engineering student, to be held on September 26th, 2022 for 2 hours with 5 questions worth a total of 35 marks and weighing 25% of the course. The exam will be proctored by 5 faculty members and requires the student to answer all questions with proper justification, assuming any missing data.
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/ 1
Roll Number:
Thapar Institute of Engineering and Technology, Patiala
Department of Computer Science and Engineering
B E- COE, CSE (VII Semester) MST Course Code: UCS802
Course Name: Compiler Construction September 26, 2022 10:30 Time: 2 Hours, M. Marks: 35 Name Of Faculty: Karun Verma, Sunita Weightage: 25 Garhwal, Avadh Kishor, Rupali Bhardwaj, Rohit Ahuja
Note: Attempt all questions with proper justification. Assume missing data, if any, suitably.
Ql.a Consider the statement
counter = counter + interest*60 (5+2) Apply each phase of the compiler on the above statement to generate the target code. Q1.b Consider the given grammar S -4 SS + I SS *Ia Draw the parse tree for the string: aa+a*
Q2 Given the regular expression r = (al b)*Iba (2+3+2)
a) Convert the given r into NFA using Thompson's construction. b) Convert the obtained NFA into DFA using subset construction. c) Minimize the obtained DFA in 2 (b).
Q3 Consider the given grammar (3+2+2)
S —> AaAbIBbBa A —> E B -4 E a) Construct First and Follow sets for the non-terminals. b) Construct the LL(1) parsing table c) Show the parsing stack and the actions for the string: ba Q4 Consider the given grammar (4+3) S-* Ilother I —> if SI if S else S a) Construct LR(0) items for the given grammar. b) Construct the DFA of LR(0) items. Q5 a) Check whether the given grammar is ambiguous or not. (2+2+3) E —> E + ESE * EIid b) Remove left recursion of the grammar Q —> QLIL. c) Explain in brief the kind of errors handled by lexical and syntax analysis phase of a compiler.