Sathyabama: Register Number

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Register Number

SATHYABAMA
INSTITUTE OF SCIENCE AND TECHNOLOGY
(Deemed to be University U/S 3 of UGC Act,1956)

Programme & Specialisation: B.E. - CSE


Title of the Paper : Compiler Design Max. Marks: 100
Course Code : SCSA1604 (2019/2020) Time : 3 Hours
Date : 02/11/2023 Session : AN
________________________________________________________
(NOTE: Assume relevant data, if found missing)

PART - A (10 × 2 = 20)


Answer ALL the Questions

1. Justify the use of input buffer in lexical analysis? What are the
commonly used buffering methods? (CO1)

2. Construct NFA for the regular expression ab*|a*. (CO1)

3. Write the rule to eliminate left recursion in a grammar. (CO2)


Eliminate the left recursion for the grammar
S→Aa | b
A→Ac | Sd |ε

4. List out the rules for FIRST and FOLLOW computation. (CO2)

5. Generate the three address code for the statement, (CO3)


If A<B then 1 else 0

6. Construct the quadruple for the following statement,


A:=B+C*D/F (CO3)
7. Define Dominator tree. (CO4)

8. What are reducible flow graphs? State the properties of reducible


flow graphs. (CO4)

9. State the input and output of code generation. (CO5)

10. Describe global register allocation? (CO5)

PART - B (5 × 16 = 80)
Answer ALL the Questions

11. Construct a DFA using subset construction method for the


regular expression (a + b)*abb using subset construction method.
(CO1)
(or)
12. Discuss the phases of a compiler indicating the inputs and outputs
of each phase in translating the statement “position: = initial *
rate + 60”. (CO1)

13. Evaluate predictive parsing table for the following grammar


and parse the string id+id*id. (CO2)
E→E+T | T
T→T*F | F
F→(E) | id
(or)
14. Consider the following grammar: S->a|^|(T) T->T,S |S
(a) Compute the leading and trailing for the above grammar.
(b) Compute the operator –precedence relation table for this
grammar and parse the string (a,^,(a)) (CO2)

15. Create an SDT for desktop calculator and evaluate the arithmetic
expression 21*7+6 (CO3)
(or)
16. Discuss the various types of intermediate code generation with
suitable examples. (CO3)

17. Explain the algorithm for construction of basic blocks (CO4)


Construct the basic blocks and create a flow graph for the
following three address statements, (CO5)
(1) X:=20 (2) if X>=10 goto (8)
(3) X:=X-1 (4) A[X] :=10
(5) if X<>4 goto (7) (6) X:=X-2
(7) goto (2) (8) Y:=X+5
(or)
18. Employ the dominator computing algorithm and formulate the
dominator list for each node in the following flow graph, (CO4)

19. Elaborate the procedure 1for converting assembly code to machine


code. (CO5)
2 3
(or)
20. Develop a simple code generator. (CO6)
4

5 6

9 1
0

You might also like