Peruvoyal, Kavaraipettai, Thiruvallur District - 601 206
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8602 - COMPILER DESIGN
IMPORTANT PART B & PART C QUESTION BANK UNIT - I 1 Describe in detail about the various phases of compiler with neat sketch with suitable example 2 Explain about specification of tokens and Recognition of tokens with example. 3 (i).Discuss in detail about the role of Lexical analyzer with thepossible error recovery actions. (ii)Describe in detail about issues in lexical analysis. 4 Explain the concept MinimizingDFA with example 5 (i) Create languages denoted by the following regularexpressions a) (a|b)*a(a|b)(a|b) b) a*ba*ba*ba* c) !! (aa|bb)*((ab|ba)(aa|bb)*(ab|ba)(aa|bb)*)* (ii) Write regular definitions for the following languages: a)All strings of lowercase letters that contain the five vowelsin order. b) All strings of lowercase letters in which the letters are inascending lexicographic order. Comments, consisting of a string surrounded by / and /, withoutan intervening */, unless it is inside double-quotes (") 6 Find transition diagrams for the following regular expressionand regular definition. a(a|b)*a ((ε|a)b*)* All strings of digits with at most one repeated digit. All strings of a's and b's that do not contain the substringabb. All strings of a's and b's that do not contain thesubsequence abb. Unit – II 1 (i) What is an ambiguous and un ambiguous grammar?Identify the following grammar is ambiguous or not. E→E+E | E*E | (E)|-E |id for the sentence id+id*id (ii) Prepare the following grammar is LL(1) but not SLR(1) (iii) . S→AaAb | BbBa A→€B→€ 2 (i).Describe on detail about the role of parser. (ii)Discuss about the context-free grammar. 3 Explain in detail about the various types of Top –down parsing. 4 (i)Define YACC parser generator. List out the Error recovery actions in YACC. (ii)List out different error recovery strategies. Explain them. Show SLR parsing table for the following grammar S → Aa | bAc | Bc | bBa A → dB → d And parse the sentence "bdc" and "dd". Construct a parse tree for the input string w-cad using top down parser . S->cAdA->ab|a 5 (i).What are the different kinds of syntax error phased by a program? Explain in detail. (ii).What are the Error recovery techniques used in Predictive parsing? Explain in detail. Unit - III 1 Discuss the following in detail about the Syntax Directed Definitions. (i) Inherited Attributes and Synthesized attributes. (ii)Evaluate SDD of a parse tree. 2 What is three address code explain different types of Three address codes with examples. 3 What is Type conversion? What are the two types of typeconversion? Evaluate the rules for the type conversion 4 Create the following uind the arithmetic expression a+- (b+c)* into (i)Syntax tree (ii)Quadruples (iii)Triples (iv)Indirect Triples 5 (i) Describe in detail about addressing array Elements. (ii)Discuss in detail about Translation of array reference. Unit IV 1 Illustrate the storage organization memory in the perspective of compiler writer with neat diagram. 2 Explain in detail about the various issues in code generation with examples 3 Discuss in detail about the activation tree and activation recordwith suitable example 4 i. Describe the usage of stack in the memory allocation and discuss in detail about stack allocation space of memory ii. Define the heap management of memory and describe in detailabout it 5 Create following assignment statement into three address codeD:=(a-b)*(a-c)+(a-c) Apply code generation algorithm to generate a code sequence forthe three address statement. Unit V 1 Explain briefly about the principal sources of optimization. 2 (i).Explain in detail about optimization of basic blocks. (ii).Construct the DAG for the following Basic block & explain it. 1. t1: = 4 * i 2. t2:= a [t1] 3. t3: = 4 * i 4. t4:= b [t3] 5. t5:=t2*t4 6. t6:=Prod+t5 7. Prod:=t6 8. t7:=i+1 9. i:= t7 10. if i<= 20 goto (1) 3 i. Explain Peephole optimization with suitable examples. ii. Discuss about loop optimization with examples. 4 What is DAG? Create DAG and three – address code for the following Cprogram. i = 1; s = 0; while ( i<= 10) { s = s+ a[i] [i];i = i + 1; } 5 Explain in detail about the data-flow schemas on basic block andthe transfer equations for reaching definitions with example