Skip to content

Compiler Design

CSE · Midterm · Summer 25

Paper 1 of 3Batch 62Switch

Batch 62

Paper 1 of 3

This browser can’t show the PDF here

Open it, and your phone’s PDF viewer takes it, or download it.

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: CSE331, Course Title: Compiler Design Level: 3 Term: 3 Batch: 62 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 a grammar designed to parse simplified time formats: T -> H:M H -> N | NN M -> NN N -> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Determine whether the grammar is ambiguous for the input string- 1:23 [5] CO1 2. a) flaot newsal(flaot B_Sal, Exp, Edu, KPI, Er_T) float b1=b2=b3=b4=0.4, nSal = B_Sal+b1*Exp+b2*Edu+b3*Sex+b4*KPI+e.Er_T*0.3 return nSal, Describe the phases of a compiler for the 3rd statement of the given function. [6] CO1 b) Find the errors in the above code 2(a) and explain how panic mode method can recover from the errors. [4] 3. a) Using the given transition diagram (TD), explain the five components (5-tuple) of the Finite State Machine (FSM). Additionally, identify whether the FSM is deterministic or non-deterministic, and justify your reasoning. [Figure: A state transition diagram with states q1, q2, and q3. State q1 has a self-loop labeled 1 and transitions to q2 on 0. State q2 transitions to q3 on 1, and has a self-loop labeled 0,1. State q3 has a self-loop labeled 0,1.] [6] CO1 b) Analyze the given grammar for Left Factoring and modify it to eliminate any occurrences while preserving its structure. E -> edu | edu.bd | edu.com | diu.edu | diu.bd | diu | educate | education | educated | twinkle | humpty | dumpty [4]