Download AKTU (Dr. A.P.J. Abdul Kalam Technical University (AKTU), formerly Uttar Pradesh Technical University (UPTU) B-Tech 6th Semester (Sixth Semester) 2017-2018 ECS603 Compiler Design Question Paper
Paperldz IJIIEEE RollN0.l l l l l l l l l l
B. Tech.
(SEM VI) CARRY OVER THEORY EXAMINATION 2017-18
Compiler Design
T ime: 3 Hours T 0tal Marks: 100
Note: 1. Attempt all Sections. If require any missing data; then choose suitably.
2. Any special paper specific instruction.
SECTION A
1. Attempt all questions in brief. 2 x 10 = 20
a) what is translator?
b) Differentiate between compiler and assembler.
c) Discuss conversion of NFA into a DP A . also give the algorithm used in this conversion.
(1) Write down the short note on symbol table.
e) Describe Data structure for symbol table .
i) What is mean by Activation record
g) What is postfix notations ?
h) Define Three address Code
i) What are Quadruples.
j) what do you mean by regular expression?
SECTION B
2. Attempt any three of the following: 10 x 3 = 30
a). Write down the regular expression for
l. The set of all string over {a,b} such that fifth symbol from right is a.
2. The set of all string over {a,b} such that every block of four consecutive symbol contain
at least two zero.
b). Construct the NFA for the regular expression a/abb/a?Fb+ by using Thompson?s construction
methodology.
c). Eliminate left recursion from the following grammar
59AB ,A?Bs | b ,B?SA | a
d). Discuss conversion of NFA into a DFA . also give the algorithm used in this conversion.
e). Explain non recursive predictive parsing. Consider the following grammar and construct the
predictive parsing table
E9TE'
E?9+TE?|?
T?FT'
T'9*FT'I?
F9F* | a | b
SECTION C
3. Attempt any one part of the following: 10 x 1 = 10
a). Give Operator ?precedence parsing algorithm. Consider the following grammar and build up
operator precedence table. Also parse the input string (id+(id*id))
E9E+T|T
T9T*F|F
F9(E) | id
b). For the grammar
S?aAd |de |aBe |bAe A?f , B?f
Construct LR(1) Parsing table .also draw the LALR table from the derived LR(l) parsing table.
4. Attempt any one part of the following: 10 x 1 = 10
a). What is postfix notations ? translate (C+D)*(E+Y) into postfix using syntax directed translation
scheme(STDS)
b). consider the following grammar E9E+E | E*E | (E) | id .construct the SLR parsing table and
suggest your final parsing table.
5. Attempt any one part of the following: 10 x 1 = 10
a). Explain logical phase error and syntactic phase error . also suggest methods for recovery of error.
b). Generate three address code for C[A[I, j] ] = B[| ,j]+C[A[ | , j ] ]+D[ | +j] (You can assume any data
for solving question , if needed) Assuming that all array elements are integer. Let A and B a 10 X 20
array with |ow1 =|ow2=1.
6. Attempt any one part of the following: 10 x 1 = 10
a). Give the algorithm for the elimination of local and global common Sub expression . discuss the
algorithm with the help of example also.
b). consider the following three address code segments
PROD := 0
l:= 1
T1:=4*|
T2:=addr(A)-4
T3:=T2[T1]
T4:=addr(B)-4
T5:=T4[T1]
T6:=T3*T5
PROD:=PROD +T6
|:=I+1
If i<=20 goto (3)
a. Find the basic blocks and flow graph of above sequence.
b. Optimize the code sequence by applying function preserving transformation and loop
optimization technique.
7. Attempt any one part of the following: 10 x 1 = 10
a). . Write short note on
i. Loop optimization
ii. Globaldataanalysis
b). . Write short note on
i. Direct acyclic graph
ii. YACC parser generator
This post was last modified on 29 January 2020