Compiler Design
CSE · Midterm · Summer 26
Paper 1 of 2Batch 67 · Ahnab ShariarSwitch
Batch 67
Paper 1 of 2
Read the questions as text
Read off the PDF by AI, so it may have mistakes. The PDF is the original.
Daffodil International University
Faculty of Science & Information Technology
Department of Computer Science & Engineering
Midterm Examination, Summer 2026
Course Code: CSE313, Course Title: Compiler Design
Level: 3 Term: 1 Batch: 67
Time: 01:30 Hrs
Marks: 25
Answer ALL Questions
[The figures in the right margin indicate the full marks and corresponding course outcomes. All portions of each question must be answered sequentially.]
1. a) Consider the following CFG:
S -> Actor Act
Act -> Event | Act Connector Act | Act Connector Act Connector Act
Actor -> hero
Event -> runs | jumps | hides
Connector -> then
Explain whether the grammar is ambiguous or not for the below input string:
hero runs then jumps then hides
[5] CO1
2. a) intt processData(float velocity, float acceleration, float len, float time) {
float 2result;
result = velocity + 4 * len - time * velocity + len - acceleration * time // target
return result + k;
}
Illustrate the phases of a compiler for the target of the given function.
[6] CO1
b) Classify the errors in the above code 2(a), and explain how panic-mode error recovery would handle the errors in this program.
[4]
3. a) Consider an FSM with the following transition table:
State | δ(q,a) | δ(q,b)
-> q0 | {q0, q1} | {q0, q2}
q1 | {q3} | {q1, q4}
q2 | {q2} | {q3}
q3 | {q4} | {q3}
*q4 | {q4} | {q2, q4}
Construct the FSM for the given transition table and identify the tuples from the FSM.
[4] CO2
b) If the FSM is an NFA, convert it into a DFA and write a regular expression that describes the language accepted by the resulting DFA.
[6]