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: BCST 602 ROLL NO……………..……………..
VI SEMESTER EXAMINATION, 2022 – 23
IIIrd year , B.Tech. Computer Science and Engineering Branch 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) Construct the regular expression into NFA: (a/b)* a (a/b) b) Give the comparative analysis of lexical and syntax analysis with suitable examples. c) Discuss the role of compiler writing tools. Describe various compiler-writing tools. d) Explain infix to postfix translation with example through SDT scheme. e) Construct LR(1) parsing table for given grammar: S->AA, A->aA/b f) Write three address code for given expression: s= (a*-b) + (-b*c) Also represent that three address code into Quadruples and Triples Q 2. Answer any four parts of the following. 5x4=20 a) Give the comparison among SLR, CLR, and LALR Parsers in compiler design b) Explain the importance of loop optimization in code optimization techniques; explore all loop optimization techniques using suitable examples. c) Represent the following in flow graph i=1;sum=0;while (i<=10){sum+=i;i++} d) What is operator precedence grammar? Compute the operator precedence table for the given grammar: E-> E+T\T, T-> T+F\F, F-> (E) | id e) Discuss the various error detection and their recovery techniques in compiler design. f) Define Syntax Directed Translation. Construct an annotated parse tree for the expression (4 * 7 + 1) * 2 Q 3. Answer any two parts of the following. 10x2= 20 a) Consider the following grammar S-AS|b A-SA|a. Construct the SLR parse table for the grammar. Show the actions of the parser for the input string “abab”. b) How would you convert the following into intermediate code? Give a suitable example. i) Assignment Statements. ii) Case Statements c) Define a directed acyclic graph. Construct a DAG and write the sequence of instructions for the expression a+a*(b-c)+(b-c)*d. Q 4. Answer any two parts of the following. 10x2= 20 a) Explain stack implementation of shift reduce parser. b) What is intermediate code? Explain different types of intermediate code representations. Also, discuss importance of intermediate code. c) Define the following terms and give suitable example for it. i) Handle ii) Handle pruning iii) Left Factoring Q 5. Answer any two parts of the following. 10x2= 20 a) What is back patching. Generate three address code for the following Boolean expression using back patching: a < b or c > d and e < f b) Define Symbol table? Explain about the data structures used for symbol table. c) What is top down parsing? What are the problems in top down parsing? Explain each with suitable example.