Get premium membership and access revision papers, questions with answers as well as video lessons.

Compiler Construction Question Paper

Compiler Construction 

Course:Bachelor Of Science In Information Technology

Institution: Kca University question papers

Exam Year:2010



UNIVERSITY EXAMINATIONS: 2010/2011
THIRD YEAR STAGE EXAMINATION FOR THE DEGREE OF BACHELOR
OF SCIENCE IN INFORMATION TECHNOLOGY
BIT 3104: COMPILER CONSTRUCTION
DATE: DECEMBER 2010 TIME: 2 HOURS
INSTRUCTIONS: Answer question ONE and any other TWO questions
QUESTION ONE
a) When programming occasionally the computer generate bugs
i) Describe three types of errors that may arise during programming [6 Marks]
ii) Of the errors that you have listed above, which ones does the compiler recognize and which
ones doesn’t it recognize [3 Marks]
b) Define what a programming language is and describe token that you can find in any language with
examples [4 Marks]
c) Describe the work of the lexical analysis [2 Marks]
d) Define what are regular expressions and TWO possible operations carried on them [3 Marks]
e) Describe the component of a Grammar and Outline Chomsky Hierarchy of Grammars [6 Marks]
f) Outline the requirement for a grammar to satisfy a Context Free Grammar [3 Marks]
g) Describe THREE language problems [3 Marks]
QUESTION TWO
a) With reference to Bottom-up Parsing, explain four Parsing actions [4 Marks]
b) Differentiate between LR(0) and LR(1) parsers [2 Marks]
c) Differentiate between terminal and non terminal symbols [4 Marks]
2
d) Given the following grammar, write the methods for parsing a genereal input.
A = B a.
B = { b } c | [ d ] | e.
C = D e | f.
D = { d }.
[10 Marks]
QUESTION THREE
a) Given the following grammar
S = A B | S A B.
A = a | a a b.
B = b | b b a.
Use it to pass the following input string
a b b a a b # (# represent the end of file)
[6 Marks]
a) In the context of compiler construction and in particular, syntax analysis define the following
terms
i). Recognition
ii). Parsing
iii). Unambiguous grammar:
[6 Marks]
b) Differentiate between bottom-up and top-down parsing [4 Marks]
c) Describe the recursive descent parser and the main Idea behind it [4 Marks]
QUESTION FOUR
a) Describe any two top-down parsers [8 Marks]
b) Write procedures to represent the following grammar
S => Ba | c
S => Ds | e
[4 Marks]
c) Given the following grammar, convert it to a CFG in preparation to parsing a string using topdown
parser
3
E=>E+E
E=>E*E
E=>(E)
E=>ID
[8 Marks]
QUESTION FIVE
a) Given the following grammar and subsequent input, workout its parsing using Bottom Up
Parser [12 Marks]
1. S ? E
2. E ? E + E
3. E ? E * E
4. E ? num
5. E ? id
Input to parse:
id1 + num * id2
b) Differentiate between type inference and type checking [4 Marks]
c) Differentiate between name equivalence and structural equivalence [4 Marks]






More Question Papers


Popular Exams



Return to Question Papers