World University of Bangladesh (WUB)
Department of Computer Science & Engineering
Mid-term Examination
Program: [Link]. in CSE, Batch: 60A
Course Title: Compiler Design, Course Code: CSE 905(CSE 06132120)
Time: 1.0 Hour Marks: 15
Answer any three of the following questions. Answering CO marked questions are
mandatory.
1. (a) While working on a new program with your friend, you mention that the 2
software you're using is a compiler. Curious, your friend asks why it is called a
compiler. Now, explain it to your friend.
(b) Write down the parse tree for the given expression- id1:= id2 + id3*id4. 3
2. (a) You are known about finite state automaton that can be used for pattern 2
recognition. Define the finite state automaton with example.
(b) You know that finite state automaton is used to find the tokens in a compiler, 3
So, for making a lexical analyzer the following state table is given to you.
Draw the state diagram for a finite state automaton using the state table.
3. Suppose you need to develop a compiler for a specific programming language. 5
State the essential phases that your compiler should include. Describe how
your compiler will implement these phases, providing an example to illustrate
the process. (CO1)
4 (a) Write the corresponding regular expression for the following statement - {mo, 3
moo, mooo……….} and for a variable of C language.
(b) 2
Find the state table for the given nondeterministic finite state automaton.