Semester : SEMESTER 6
Subject : Compiler Design
Year : 2020
Term : SEPTEMBER
Branch : COMPUTER SCIENCE AND ENGINEERING
Scheme : 2015 Full Time
Course Code : CS 304
Page:1
Reg No.:
03000CS304052001
Pages: 3
Name:
APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY
Sixth semester B.Tech examinations (S), September 2020
Course Code: CS304
Course Name: COMPILER DESIGN
Max. Marks: 100 Duration: 3 Hours
b)
PARTA
Answer all questions, each carries 3 marks. Marks
State the role of lexical analyzer. Identify the lexemes and their corresponding (3)
tokens in the following statement: printf (“Simple Interest=“f\n”, si);
Explain any three tools that help a programmer in building a compiler (3)
efficiently.
Eliminate the ambiguity from the given grammar (3)
E > E*E | E-E| E*E | E/E| E+E | (E) | id.
The associativity of the operators is as given below. The operators are listed in
the decreasing order of precedence.
)0( ()
(ii) / and + are right associative
(111) ^ is left associative.
(iv) *and~—are left associative
For what type of grammar, recursive descent parser cannot be constructed? (3)
Show the steps involved in recursive descent parsing with backtracking for the
string cad with the given grammar: 5 -> cAd A->ab|a
PART تا
Answer any two full questions, each carries 9 marks.
Trace the output after each phase of the compiler for the assignment statement: (6)
a=b+c * 10, if variables given are of float type.
Show that the following grammar is ambiguous. (3)
bexpr > bexpr OR bterm | bterm
bterm > bterm AND bfactor | bfactor
bfactor > NOT bfactor | (bexpr) | TRUE | FALSE
Page 1 of 3