Maasai Mara University: Regular University Examinations 2017/2018 ACADEMIC YEAR Third Year Second Semester

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

MAASAI MARA

UNIVERSITY

REGULAR UNIVERSITY EXAMINATIONS


2017/2018 ACADEMIC YEAR
THIRD YEAR SECOND SEMESTER

SCHOOL OF SCIENCE AND INFORMATION SCIENCES


UNIVERSITY EXAMINATIONS FOR THE DEGREE OF
BACHELOR OF SCIENCE (COMPUTER SCIENCE)

COURSE CODE: COM 322E


COURSE TITLE: COMPILER DESIGN

DATE: 24TH AUGUST 2018 TIME: 0830 – 1030 HRS

INSTRUCTIONS

Answer Question ONE and any other TWO

1|Page
SECTION A
QUESTION ONE (COMPULSORY 30 MARKS)

a. The high-level language is converted into binary language in various


phases. Discuss Language Processing System [10 Marks]

b. Discuss four components of a context free grammar [4 Marks]


c. Discuss four items which the code generator should take into
consideration in order to generate the code [8 Marks]
d. Discuss the following terms as used in compiler design
i. Directed Acyclic Graph
ii. Token
iii. Attribute grammar
iv. Compiler [8 marks]

SECTION B
QUESTION TWO
a. Discuss five components of finite automata [5 Marks]
b. Convert the following regular grammar to finite automata
A aB/bA/b
B aC/bB
C aA/bC/a [10 Marks]
c. discuss the differences between compilers and interpreters[5 Marks]

QUESTION THREE
a. Draw parse tree of the following derivation
i. E → E+E
id + E
id + E*E
id + id*E
id + id*id [10 Marks]

b. Discuss various phases of a compiler [10 Marks]

QUESTION FOUR
a. Discuss the following categories of code optimization
i. Machine independent optimizations:
ii. Machine dependent optimization [10 Marks]
b. Discuss the following types of basic block optimizations.
i. Structure-Preserving Transformations
ii. Algebraic Transformations [10 Marks]

2|Page
END//

3|Page

You might also like