We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2
Sub Code: BCST602 ROLL NO……………..……………..
EVEN SEMESTER EXAMINATION, 2023 – 24
3rd yr B.Tech. – Computer Science & Engineering Compiler Design
Duration: 3:00 hrs Max Marks: 100
Note: - Attempt all questions. All Questions carry equal marks. In case of any ambiguity or missing data, the same may be assumed and state the assumption made in the answer.
Q 1. Answer any four parts of the following. 5x4=20
a) What is difference between Compiler and Interpreter? b) Discuss the action taken by every phase of compiler for the following statement. Position:= initial+rate*60. c) Design NFA by using Thompson’s construction algorithm for regular expression (a|b)*abb. d) Construct predictive parsing table for the grammar S→iEtSeS|iEtS|a, E→ b. e) Discuss Operator Precedence Parsing algorithm with example. f) What is ambiguous grammar? identify whether following grammar is ambiguous or not. S→ aSbS | bSaS | λ. Q 2. Answer any four parts of the following. 5x4=20 a) What are the various storage management techniques in symbol table? b) Draw the syntax tree and DAG for the following expression: (a*b)+(c-d)*(a*b)+b c) What is activation record? Write the various fields of Activation Record. d) Classify the errors and discuss the errors in each phase of Compiler. e) What are basic blocks? Write the algorithm for partitioning into Blocks. f) What is control and data flow analysis? Explain with example. Q 3. Answer any two parts of the following. 10x2= 20 a) Show the following grammar S→Aa|bAc|Bc|bBa , A→d ,B→ d Is LR(1) but not LALR(1) b) Write the properties of LR parser with its structure. Also explain the techniques of LR parser. c) What is LALR parser? Construct the set of LR(1) items for this grammar: S→ CC, C→ aC , C→d Q 4. Answer any two parts of the following. 10x2= 20 a) Write quadruples, triples and indirect triples for the expression: -(a*b)+(c+d)-(a+b+c+d) b) Write the short note on: i. Abstract syntax tree ii. Polish notation iii. Three address code iv. Backpatching c) Write the definition of symbol table and procedure to store the names in symbol table. Q 5. Answer any two parts of the following. 10x2= 20 a) Write the comparison among Static allocation, Stack allocation and Heap Allocation with their merits and limitations b) What is code optimization? Explain machine dependent and independent code optimization. c) Consider the following program code: Prod=0; I=1; Do{ Prod=prod+a[i]*b[i]; I=i+1; }while (i<=10); i. Partition it into blocks ii. Construct the flow graph