👁️ 219 views
University of Barishal Logo

University of Barishal

Department of Computer Science and Engineering

Final Exam

Course Title: Compiler Design and Construction (CSE-4103)

Semester: 7th | Session: 18-19

Time: 180 minutes | Marks: 60.00

Course Teacher: Dr. Md Manjur Ahmed

Answer any Five Questions from the followings.

1.


a)

Analyze: Static versus Dynamic Checking.

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
4 Marks
b)

Predictive parsing is a special form of recursive descent parsing where we use one LOOKAHEAD token to unambiguously determine the parse operations. When a nonterminal has multiple productions, each production is implemented in a branch of a selection statement based on input look-ahead information.
Execute the example (Fig. 1) using Predictive Parser.

Input: array   [    num     dotdot    num    ]    of    integer

            ↑

     lookahead
 

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
8 Marks
2.


a)

Define type equivalence. Explain the role of intermediate code generator in compilation process.

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
3 Marks
b)

Construct a quadruple, triples for the following expression:

a + a*(b-c) + (b-c)*d?

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
5 Marks
c)

Define peephole optimization. Explain machine dependent and machine independent optimization?

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
4 Marks
3.


a)

Define tokens, patterns, and lexemes with examples. What is the function of the lexical analyzer? Demonstrate the Interactions between the lexical analyzer and the parser.

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
4 Marks
b)

What are operations on Language? Let L be the set of letters {A, B, ..., Z, a, b,..., z} and let D be the set of digits {0, 1,...,9}. We may think of L and D in two, essentially equivalent, ways. One way is that L and D are, respectively, the alphabets of uppercase and lowercase letters and of digits. Show some other languages that can be constructed from languages L and D, using the union, concatenation, Kleene closure and Positive closure operators.

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
4 Marks
c)

Briefly explain the rules that define regular expressions over some alphabet and the languages that those expressions denote using basis and induction. How do you recognize the reserved words and identifiers? Show the transition diagram of relop.

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
4 Marks
4.


a)

 What is a dangling else?

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
5 Marks
b)

How can the following grammar be ambiguous for (id - id / id)?

        E→ E-E | E/E | -E | (E) | id

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
7 Marks
5.


a)

Differentiate the terms (i) Yacc compiler, (ii) Lex compiler, and (iii) C compiler

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
6 Marks
b)

Discuss about Handles.

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
2 Marks
c)

The following is a substring of grammar symbols: 

a b b c d e                       

Prove that this substring shows the property of "Handle".

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
4 Marks
6.


a)

Describe algorithm for LR Parser.

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
6 Marks
b)

Based on LR Parsing, for the following grammar, show all steps for the stack, input, and action.

Grammar:

1. E → E+T

2. E → T    

3. T → T* F

4. T → F     

5. F → (E)  

6. F → id    

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
6 Marks
7.


a)

Distinguish the following terms for error recovery in LR Parsing:
        i) Panic mode,
        ii) Phrase-level recovery

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
4 Marks
b)

Construct the predictive parser for the following grammar

S->(L)/a

L->L,S/S

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
4 Marks
c)

Construct the LR parsing table for the following grammar:
E → E + T | T
T → T*F | F
F→(E) | id

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
4 Marks
8.


a)

Let, you would like do parsing for syntax analyzer. Write down a table to show FOLLOW(A).

            E →T ER

            E→ + T ER | ε

            T → F TR

              TR → * F TR | ε

            F → (E) | id

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
6 Marks
b)

Give specific examples of static checking for the followings:

a) Overloading, Coercion, and Polymorphism, b) Flow-of-Control Checks.

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
6 Marks

---------------------------------------------***---------------------------------------------

Contributors of this Question:

Role Name Date
Prepared By (Teacher): Dr. Md Manjur Ahmed N/A
Uploaded By: Subrina Jahan Meem Jan. 8, 2025, 2:31 p.m.
Converted By (Img/PDF to Text): Baishakhi Bir Feb. 9, 2026, 10:28 p.m.
Reviewed By: Obaydul Hasan Nayeem Feb. 10, 2026, 8:08 p.m.