Compiler Design
CSE · Midterm · Summer 25
Paper 2 of 3Batch 64 · MD. RUHUL AMINSwitch
Batch 64
Paper 2 of 3
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
Mid Examination, Summer 2025
Course Code: CSE313, Course Title: Compiler Design
Level: 3 Term: 1 Batch: 64
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) S → P M Y
P → G T
G → Gen | Millennial | Boomer
T → z | x | alpha
M → June | July | May | August
Y → D D D D
D → 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
For the input string: “Gen z June 2025”, determine whether the CFG is ambiguous or not. [5] CO 1
2. a) Describe the phases of a compiler for the following expression.
Exp = Sal - β1×X + β2×Y + β3×Z + ε * 0.3 [6] CO 1
b) Consider the following grammar. If there is Left Recursion then eliminate it.
A → Cx | Ay
B → m | An | Cp
C → Ae | x [4]
3. a) A simplified access control system is being modeled using a Finite State Machine (FSM). In this system, a user must swipe their ID card (s), enter a correct PIN (p), and then the system grants access (a). The system also allows users to re-enter PIN if it was mistyped after swiping. Design a Finite Automaton (FA) that accepts all such strings. Clearly label all states, transitions, and final state(s) and explain the five components (5-tuples) of that Finite State Machine (FSM). [6] CO 1
b) If the 3(a) FSM is classified as a NFA (Non-deterministic Finite Automaton), transform it into an equivalent DFA (Deterministic Finite Automaton). If it is already a DFA, provide a justification for why it meets the criteria of determinism. [4]