1. The document is a midterm examination for an MCA program with three sections:
- Section A contains short answer questions testing basic compiler concepts.
- Section B contains a longer question about code optimization techniques or activation records.
- Section C contains a programming question to construct a parsing table.
2. Key concepts covered include triple relations, DAG construction, handle pruning, back patching, LR parsing, reduce-reduce conflicts, and the differences between SDD and SDT.
3. Students must demonstrate understanding of compiler design foundations as well as the ability to apply these concepts through programming questions constructing parsing tables for given grammars.
1. The document is a midterm examination for an MCA program with three sections:
- Section A contains short answer questions testing basic compiler concepts.
- Section B contains a longer question about code optimization techniques or activation records.
- Section C contains a programming question to construct a parsing table.
2. Key concepts covered include triple relations, DAG construction, handle pruning, back patching, LR parsing, reduce-reduce conflicts, and the differences between SDD and SDT.
3. Students must demonstrate understanding of compiler design foundations as well as the ability to apply these concepts through programming questions constructing parsing tables for given grammars.
1. The document is a midterm examination for an MCA program with three sections:
- Section A contains short answer questions testing basic compiler concepts.
- Section B contains a longer question about code optimization techniques or activation records.
- Section C contains a programming question to construct a parsing table.
2. Key concepts covered include triple relations, DAG construction, handle pruning, back patching, LR parsing, reduce-reduce conflicts, and the differences between SDD and SDT.
3. Students must demonstrate understanding of compiler design foundations as well as the ability to apply these concepts through programming questions constructing parsing tables for given grammars.
SUB-CD TIME-1HR FULL MARKS-30 SEC-A(Compulsory) 5*2=10marks 1.a)Mention the TAC of the following code segment int a=0; int b=40; for(i=0; i<n; i++){ if i<10 then a=b+1; else a=a*a; }x=a*b; b) Differentiate between synthesized & inherited attribute c)Mention the triples of the following expression - (x-y) -(x-y-z) *(x+y+z) d)Construct the DAG of the following expression A= (B-C)/(B-C)*(A-B-C) e)Test whether the following grammar is in LL(1) or not S→ aSa | € f) Define handle pruning. g) What are the LR(0) items. h) What is back patching ?Explain with an example. i) Why LR parsing is prefer over other parsers ? j) What is reduce- reduce (R-R) conflict in LR parser . k) Differentiate between SDD & SDT
SEC-B(Answer any one) 6marks
1.. What are the different Code Optimization techniques used in compilation process to generate optimized code. 2..What is an Activation Record. Explain all the parameters of an Activation Record. 3..Explain major issues in Code generator phase. 4..Construct a DAG for the following sequence of statements X=Y/Z W=P*Y Y=Y*Z P=W-X
SEC-C(Answer any one) 16 marks
1.Construct an LALR parsing table for the following grammar. S → Aa | bAc | dc | bda A→ d 2. .Construct an SLR parsing table for the following grammar. S → ( ) | a | (A) A → S | A,S 3. .Construct an LR(1) parsing table for the following grammar E → (L) | a L → L,E | E TRIDENT GROUP OF INSTITUTIONS, BHUBANESWAR 2nd MIDTERM EXAMINATION 2022, 3RD SEMESTER, MCA SUB-CD TIME-1HR FULL MARKS-30 SEC-A(Compulsory) 4*2=8marks 1.a)Mention the TAC of the following code segment int a=0; int b=40; for(i=0; i<n; i++){ if i<10 then a=b+1; else a=a*a; }x=a*b; b)Mention the triples of the following expression - (x-y) -(x-y-z) *(x+y+z) c) Define handle pruning d) What is back patching ?Explain with an example
SEC-B(Answer any one) 1*6=6marks
1.. What are the different Code Optimization techniques used in compilation process to generate optimized code. 2..Construct a DAG for the following sequence of statements X=Y/Z W=P*Y Y=Y*Z P=W-X
SEC-C(Answer any one) 1*16=16 marks
1.Construct an LALR parsing table for the following grammar. S → Aa | bAc | dc | bda A→ d
2. .Construct an LR(1) parsing table for the following grammar