ExamsSCHOOL OF SCIENCE AND TECHNOLOGY

National Open University Exam Past Question – CIT 445 MAY/JUNE 2012 EXAMINATION

NATIONAL OPEN UNIVERSITY OF NIGERIA CIT 445 Principles & Techniques of Compilers

14-16 AHMADU BELLO WAY, VICTORIA ISLAND LAGOS SCHOOL OF SCIENCE AND TECHNOLOGY

MAY/JUNE 2012 EXAMINATION

 

 

CIT 445 Principles & Techniques of Compilers

Time Allowed: 2½ hrs

 

Instruction:     Answer any five (5) questions

 

 

1a) Define formal Grammar. ) 4 marks

  1. b) List and define the four basic types of grammars in the field of Computer Science ) 8 marks
  2. c) Given the grammar G with following production rules, S → a | aS | bS, determine whether

the string bbaaba can be generated by the grammar ) 2marks

 

 

2a) Define formal language ) 3 marks

  1. b) State three of the uses of formal languages ) 3 marks c) What is a translator? ) 2marks
  2. d) Why do we need a translator?) 3 marks
  3. e) Enumerate the functions performed by the lexical analyser ) 4 marks

 

 

3a) Compare interpreter and compiler ) 5 marks

  1. b) State any five qualities of a compiler ) 5 marks
  2. c) State the knowledge needed to build a compiler ) 4 marks

 

 

4) With the aid of illustrative diagram describe the phases of a compiler.) 14 marks

5) Consider the grammar G below: G: E ® E + T / T

T ® T * F / F F ® (E) / i

  1. a) Generate the non-left recursive version of the grammar ) 5 marks
  2. b) Find FOLLOW of all the nonterminal symbols  in the non-left recursive version of the grammar ) 9 marks
YOU MAY ALSO LIKE  National Open University Exam Past Question – AEM 450 MAY/JUNE 2012 EXAMINATION

 

6a) What are the benefits of LR parsing? ) 5 marks

  1. b) List the common techniques for building tables for an “LR” parser stating the

characteristics of each?  ) 6 marks c)   Consider the grammar,

 

G:        E → E + T | T T → T*F | F

F → (E) | i

What is the augmented grammar for this grammar. ) 4 marks

 

 

7) Consider the grammar, G: S → a | aS | bS

  1. a) Find the LR(0) items for this grammar ) 10 marks
  2. b) Construct an NFA whose states are the LR(0) items from (a). )4 marks

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Close