Second-Exam - Philadelphia University Jordan

Philadelphia University
Faculty of Information Technology
Lecturer
: Dr. M. Maouche
Coordinator
: Dr M. Maouche
Internal Examiner : Dr. N. Nameer
Examination Paper
Department of Computer Science
Course Name: Compiler Construction (750324)
Second Exam
Second Semester
Academic Year: 2014/15 Date: May, 12th , 2015
Section: 1
Time: 50 minutes
Information for Candidates
1.This examination paper contains 4 questions, totaling 20 marks.
2.The marks for parts of questions are shown in round brackets.
Advice to Candidates
1. You should write your answers precisely, clearly and to the point .
I. Basic Notions
Objectives. The aim of the question in this part is to evaluate the required minimal student
knowledge and skills. Answers in the pass category represent the minimum acceptable
standard.
Question1: (9 marks)
1. Name three reasons why lexical analysis is separated from syntactic
analysis.
(2 marks)
2. Describe briefly the difference between top down and bottom up
syntactic parsers.
(2 marks)
3. State three advantages of LR parsing.
(2 marks)
4. Name two different LL parsing techniques.
(1 mark)
4. Describe briefly the panic mode error strategy.
(2 marks)
II. Familiar Problems Solving
Objectives. The aim of the question in this part is to evaluate that the student has some
basic knowledge of the key aspects of the lecture material and can attempt to solve
familiar problems
Question2: (4 marks)
Consider the grammar

x | yC | 
B Cz A
C xB

where {A, B, C} is the set of non terminal symbols, A is the start
symbol, {x, y, z} is the set of terminal symbols and  denotes the empty
string.
1. Compute First (A).
2. Compute Follow (B).
(2 marks)
(2 marks)
Question3: (3 marks)
Consider the following grammar:
S → BC
B →a
C→a
B and C are non terminal symbols, a is a terminal symbol.
Input string: aa$
Apply the shift - reduce parser to parse the above input string and draw
the corresponding parsing table.
III. Unfamiliar Problems Solving
Objectives. The aim of the question in this part is to evaluate that the student has some
basic knowledge of the key aspects of the lecture material and can attempt to solve
unfamiliar problems.
Question4: (4 marks)
Consider the following grammar:
E→E+T
E→T
E → id
The goal here is to construct a subset of the LR (0) states for the
above grammar.
1. Find out the state I0.
2. Compute the following states:
I1 =Goto (I0, E);
I2=Goto (I0, T);
I3= Goto (I1, +)