Dr.A.P.J.Abdul Kalam University
Bachelor of Engineering
Seventh Semester Main Examination, Dec-2020
Compiler Design [CS-701]
Branch: CSE
Time: 3:00 Hrs Max Marks 70
Note : 1. Attempt any five questions out of eight.
2. All question carry equal marks.
Q.1 (a) Write the production rules to eliminate the left recursion and left factoring problems.
(b) Consider the grammar: E → 2E2 | 3E3 | 4
Perform Shift Reduce Parsing for input string “32423”.
Q.2 (a) Write Three Address Code for the following expression-
- (a x b) + (c + d) – (a + b + c + d)
(b) Write Rules to construct FIRST Function and FOLLOW Function.
Q.3 (a) Differentiate LR, SLR, CLR and LALR. Which one is more powerfull?
(b) Construct syntax tree and postfix notation for the following expression:
(a+(b*c)^d-e/(f+g)
Q.4 (a) Consider the grammar S→ aAd | bBd | aBe | bA A→ C B→ C
Find out that the given grammar is LALR (1) parser or not?
(b) Write quadruples, triples and indirect triples for the expression: -
(a*b)+(c+d)-
Q.5 (a) Consider the given grammar- S → ( L ) | a
L → L , S | S
Construct the operator precedence parser and parse the string ( a , ( a , a ) ).
(b) Write the short note on:
i) Abstract syntax tree ii) Polish notation
iii) Three address code iv) backpatching
Q.6 (a) What is parse tree? Construct parse tree for s → SS* I ss+ I a
(b) What are the properties of code generation phase? Also explain the Design Issues of this
Phase.
Q.7 (a) What is code optimization? Explain machine dependent and independent code optimization.
(b) Show the following Grammar: S→ AaAb|BbBa A→ € B→ € Is LL(1) and parse the input
string “ba”.
Q.8 (a) What is common sub-expression and how to eliminate it? Explain with example.
(b) Draw the syntax tree and DAG for the following expression: (a*b)+(c-d)*(a*b)+b
Attachment & Scanned Copies:
0 comments:
Pen down your valuable important comments below