Compiler Design

March 27, 2018 | Author: Balaram Rath | Category: Parsing, Compiler, Regular Expression, C (Programming Language), Software Engineering


Comments



Description

Compiler DesignPART-A Questions 1. Is macro processing a phase in compilation? Justify your answer Question Bank 2. A ______is a program that collects statistics on the behavior of the object program during execution 3. Determine whether the following regular expressions define the same language? (ab)* and a*b* 4. Why is buffering used in lexical analysis? What are the commonly used buffering methods? 5. _________ verifies whether the input string can be generated from the grammar of the source language. 6. Write the subset construction algorithm 7. ___________ parsers build parse trees starting from the root node and work down to the leaves. These parsers satisfy _____ grammars 8. List the properties of an operator grammar 9. What are the types of attributes in an attributed grammar? 10. What optimization can you propose for the following code a := b*c; x := b*c +5; 11. Define text formatters. 12. Write three address code for the expression r := 9*2+7. 13. Write shorthand notation for rr*. 14. Define finite automata. 15. What is LL(1) grammar? 16. What is YACC? 17. What are the two types of attributes that are associated with a grammar symbol? 18. State different storage-allocation strategies. 19. Give example for algebraic transformation on basic blocks? 20. Name tow descriptors used in code generation algorithm? 21. __________ is a program that reads a program written in one language and translates it into an equivalent program in another language. Karunya University | Dept. of Information Technology Compiler Design 22. What are the two classes of parsing methods? 23. Define Lexeme. 24. Write any two algebraic properties of regular expression. Question Bank 25. __________ is a program consisting of a procedure for every non terminal. 26. What do you mean by ambiguous? 27. Define Annotated parse tree. 28. __________ keeps track of live procedure activations. 29. A loop that contains no other loops is called a __________. 30. Define optimizing compiler. 31. What is the purpose of semantic analysis in a compiler? 32. What are cousins of a compiler? 33. Draw NFA for regular expression (s/t). 34. What is meant by Lexeme? 35. List out bottom up parsing. 36. What is canonical derivation? 37. What is inherited attribute? 38. What is coercion? 39. What is constant folding? 40. What is a basic block? 41. 42. 43. 44. 45. 46. 47. List the functions of a preprocessor. List the cousins of a compiler. What language does the regular expression (0|1)*0(0|1)(0|1) generate? Define e-closure. What language does the grammar S →aSa | bSb | c generate? Define operator grammar. What is meant by quadruple? Karunya University | Dept. of Information Technology 62. 66. What is meant by Kleene Closure? Define optimizing compilers. 61. What is meant by a Look ahead symbol? What is three address code? Define annotated parse tree. List out the cousins of compiler. 63. 60. 65. Compare DFA and NFA. Define Lexeme. 59. of Information Technology aSb | c generate? . 64. 58. Question Bank Translate the arithmetic expression a * . What is synthesized attribute? Give the postfix for a=b*-c+b*-c Define constant folding.Compiler Design 48. 50. Karunya University | Dept. 72. What is an interpreter? List any two cousins of compiler. 67. Define ‘Handle Pruning’ in bottom-up parsing. Write a regular expression for an identifier. List two compiler construction tools. 69. 53. 54. What language does the grammar S Define ambiguity of a grammar. 51. 57. 55. 52. What is called annotated parse tree? Define flow graph. 49. 71. Define lexeme. 56. 68. Construct a DAG for the expression a=b*-c + b*-c Define symbol table. 70.(b + c) into a syntax tree. 73. Give example. What is data flow analysis? Define Ambiguous grammar. Mention the four values of LR parsing table. 90. 86. 81. 80. 75. Define a context free grammar.Compiler Design 74. Mention the strategies of storage allocation. What does the front end of a compiler do? Write the components of context free grammar. List the properties of operator precedence grammar. 97. of Information Technology . 83. 95. List the various error recovery strategies for a lexical analysis. 91. Karunya University | Dept. How is the C language identifier represented by a regular expression? Write the purpose of minimizing the states of the DFA in a lexical analyzer. 76. 92. 84. 99. Give an example of static checks. List the common syntactic errors. 96. where does the control return to? Define semilattice. 79. What are the problems with top down parsing? Question Bank What are the various types of intermediate code representation? What is back patching? What is a flow graph? What are the basic goals of code movement? What is a byte code? What is the use of an interpreter? How is a character string recognized? Define Lexeme. when the instruction HALT is given. 87. 82. 98. 78. 94. 93. 77. 85. 88. 89. What do you mean by panic mode error recovery? What is syntax directed definition? What is the use of a dependency graph? In a program. Write the various three address code form of intermediate code. 103. 106. of Information Technology . 109. How are dummy blocks with no statements indicated in global data flow analysis? What are the two parts of compilation? Define ambiguous grammar. 121 . __________ represent strings of characters in the source program. What are the two phases of lexical analyzer? Write the regular expression for the language. Karunya University | Dept. Mention the conflicts that occur in shift-reduce parser. 111. 120. What is the various output form of the code generator? What is meant by real time operating systems? Compare loosely coupled and tightly coupled system. 114. 116. 108.Compiler Design 100. 104. 112. 110. 122.c} that contain exactly one b. 102. 119. 105. What is meant by context switch? What are the benefits of multithreaded programming? Question Bank What are the three requirements that a solution to the critical-section problem satisfy? Define deadlock. What is compaction? How do you compute the effective access time for a demand-page system? What is latency time? What are streams? What are the functions performed by analysis phase of a compiler? Mention the components of context free grammar. What are the functions used to create the nodes of the syntax trees for expressions with binary operators? List out the methods available to represent the value of Boolean expression. 113. the set of strings over {a. Name the techniques in loop optimization. 117. 115. Define left factoring. 118. 107. 123. 101.b. d. what is the name of the syntax directed definition? 138. What is the role of lexical analysis phase? A top-down parser generates a. 139. 125. 142. 136. Give an example for a dangling reference. of Information Technology . 131. (True/ False)? Write the regular expression for a sequence of binary numbers. “baan” is a subsequence of the string “banana”. 135. List the various static checks. Define basic block. When is a grammar said to be left recursive? 137. c. 140. List any two cousins of a Compiler. Define Compiler. right-most derivation in reverse left-most derivation in reverse Karunya University | Dept. 134. Question Bank Write the regular expression for denoting the set containing the string ‘a’ and all strings consisting of zero or more ‘a’’s followed by a b. What is parsing? What do you mean by Cross-Compiler? Define lexeme. 128.Compiler Design 124. 144. right-most derivation left-most derivation b. Define induction variables. 130. The rightmost derivation is known as ____________. 143. 129. 126. In a syntax directed definition if all attributes are synthesized. 132. 127. 141. Why is error detection and recovery centered around syntax analysis phase? What is parsing? Mention the restrictions that are invoked by translation routines during parsing? Why do we need backpatching? List the benefits of using a machine independent form. 133. 145. 153. c} that contain exactly one b. 158. b.Compiler Design Question Bank 146 Context Free Grammar can be recognized by Push Down Automata. 154. 157. 151. 152. 155. List the functions performed by analysis phase of a compiler. token and pattern Draw the parse tree for the following natural language grammar: Sentence Noun Phrase Verb Phrase Article Noun Adjective Noun Verb à à à à à à à à <Noun Phrase><Verb Phrase> <Article><Noun> <verb><Noun Phrase> an | a <Adjective> <Noun> huge animal | elephant is Karunya University | Dept. 148. 156. the set of strings over {a. Write the regular expression for the language. List the two classes of transformations applied to basic blocks. of Information Technology . Write the different storage allocation strategies. Differentiate between lexeme. Define left factoring. Draw syntax tree for the expression a=b*-c+b*-c. Define basic block. List the various lexical errors. 160. 149. Name some variety of intermediate forms. 2. 159. Mention some of the major optimization techniques. Write the operations on NFA states. Mention the components of context free grammar. List out the methods available to represent the value of Boolean expression. How to represent the dummy blocks with no statements indicated in global data flow analysis? PART-B Questions 1. 150. (True/False) 147. 8. 19. What is activation tree? What is copy propagation? Give example. Identify whether the following grammar is ambiguous: G={(S). 12. 7.S} Question Bank Is the following grammar left recursive? If so eliminate left recursion S à Aa | b A à Ac | Sd | e What are the advantages of LALR parsing over SLR and CLR methods? What do you meant by data-flow engine? Draw the transition diagram for identifier. 9. 17. Give example for reduction. Give quadruples and triples for an assignment statement a := b*-c + b*-c. 23. 10. 18. 4.{a.b}. What are the different data structures used for symbol table? Compare syntax tree and parse tree. Write an algorithm for construction of dependency graph from a parse tree. Consider the arithmetic expression grammar. 15. Describe about type systems. show left most and right most derivation for id + id * id and draw their parse trees. 16.Sàb}. Write a short note on functions of preprocessors. Write a segment of code to move forward pointer of input buffer. 13. 14. A ® aBcC | aBb | aB | a B® ε C®ε Karunya University | Dept. Do left factoring in the following grammar. What are the issues in lexical analysis? Write a short note on left factoring. of Information Technology .Compiler Design 3. 11. position : = initial + rate* 60 5. 21. 22.{SàSaS. What are the different operations used to define semantic rules? Draw a Parse tree for the assignment statement using appropriate grammar. 6. 20. What are the phases that constitute the front end of a compiler? Write the algorithm for FOLLOW. What is shift – reduce conflict? Give the syntax-directed definition for if-else statement. 33. 26.Compiler Design 24. 36. 31. What is a basic block? Give an example. 39. Define l-value and r-value. 37. 34. Mention the different storage allocation strategies. 43. What are its functions? Question Bank What are the different strategies employed by parsers to recover from a syntactic error? Remove left recursion in the following grammar. 27. Differentiate lexical analysis and parsing. List the steps for a language processing system. 44. What are the properties of Regular Expression? Discuss about the ‘panic mode’ error recovery strategies of the parser. What is meant by induction variable elimination? Define Preprocessor. 30. Draw the parse tree for the arithmetic expression id + (id * id). What are registers and address descriptors? Write a short note on input buffering techniques. 35. 40. 46. 32. 45. 25. 47. of Information Technology . Karunya University | Dept. S→AS | b A→SA | a Compare quadruples and triples. How is the syntax tree constructed? What does data flow analysis frame work consist of? What are the functions of structure editor? Why are regular expressions used to define lexical syntax of a language? 29. 41 42. 28. 38. Write shortly about DAG (Directed Acyclic Graph) representation. and long-term schedulers. 53. 63. Write an algorithm to partition a sequence of three-address statements into basic blocks. of Information Technology . 56.Compiler Design 48. 66. 62. medium-term. E à E + E | E * E |(E) | id. 60. 62. What is an Activation record? Draw the DAG for the statement a=(a*b+c)-(a*b+c). 54. 58. Write the leftmost derivation and rightmost derivation for the sentence (id*id)+id. 65. List any three services provided by an operating system. Show the techniques available to construct an LR parsing table for a grammar and features. 52. 50. 49. 59. 65. What are the three storage allocation strategies? What are the difficulties in instruction selection? Explain about Assembler with an example. Karunya University | Dept. 63. Draw the syntax tree and postfix notation for the expression a: =b*-c Draw the DAG for the expression a: = b *-c + b*-c. Summarize the Safety Algorithm. 57. 61. Write an algorithm to eliminate left recursion from a grammar. Compare short-term. Write the algorithm to find the FIRST of nono-terminals. What is the function of Query interpreters? List the issues involved in lexical analysis. 64. 55. Explain how each provides convenience to the users. 51. What are the various scheduling criteria for CPU scheduling? What is low-level formatting? What are the functions performed when the preprocessors produce input to compilers? Define NFA and DFA. 64. Question Bank What are the different types of errors a program can contain? List out the error handling strategies. Write about type systems and checking of types. Write the algorithm to carry our operator precedence parsing action and explain Karunya University | Dept. ( * of gcd*) a. n: integer): integer. A ® Ac/Sd/e? What are the three kinds of intermediate representations? Explain them. m mod n) end. begin if n = 0 then gcd := m else gcd := gcd (n. 68. 62. . Eliminate left recursion from the grammar. “id-identifier”. Write a note on syntax directed translation. Explain in detail the process of compilation. Write about type systems and checking of types. Write state program for the token. lexemes in the following function: function gcd (m.Compiler Design 66. 69. Write about the role of the parser. Construct the NFA. 64.b}. Question Bank Define left recursion. 3. Illustrate the output of each phase of compilation for the input “a = ( b+c )* ( b+c ) * 2” 2. S ® Aa/b. 4. Identify the token and. b. Draw the syntax tree and postfix notation for the expression a: =b*-c. What is the role of the lexical analyzer? Explain b. Define the flowing terms Compiler. 70. of Information Technology 5. Interpreter. Translator and differentiate between them. What is the step takes place in peephole optimization? What are the characteristics of peephole optimization? Write the benefits of intermediate code generation. 66. a. a. 63. Differentiate NFA and DFA. Why is it necessary to study the theory behind the design of compiler. PART –C Questions 1. 67. 65. DFA and minimized DFA for the regular expression have single line comments with characters from the alphabet {a. x. do j = j+ 1. int v.val = $1. Karunya University | Dept.val . Compare the different implementations of three address codes with examples b. a[i] = a[n].} B-op → * {$0. S → aSbS | bSaS | ε 6. if (n <= m) return. } x = a[i].val ($1. of Information Technology . while (a[j] > v).val . a]j] = x.} B-op → + {$0. if( i >= j) break. while (a[i] < v). Show the actions of the parser for the input string “abab”. Describe the syntax directed translation procedure for assignment statements with integers and mixed types and explain. a[i] = a[j].val = TIMES . 7.} Expr → Expr B-op Expr {$0. v = a[n]. Are the attributes in the following CFG synthesized or inherited? Give reasons: Var → IntConstant {$0. Construct the TAC and draw the flow graph for the following procedure.lexval . int n) { int i.val ).} 8. a]n] = x.$3. j. Construct the operator precedence parse table for the following grammar and show its shift-reduce actions for the input string “ abab”. 9. x = a[i]. Consider the following grammar S → AS | b A → SA | a Construct the SLR parse table for the grammar.val = PLUS .val = $2. i = m-1.Compiler Design Question Bank b.val = $1.} Expr → Var {$0. void quicksort(int m. a. j = n. while(1) { do i = i+ 1. Explain the issues of code generator.Compiler Design quicksort(m. Explain non recursive predictive parsing in detail. 18. Explain the various phases of compiler in detail with suitable example. quicksort(i+1. b. Explain program development environment. What is left recursive grammar? How will you eliminate? Give example. Explain the Syntax directed definition for construction of syntax tree with example. Karunya University | Dept. Explain different type expressions with example. 25. 12. Explain different phases of compiler in detail. 14. Explain how to incorporate a symbol table. of compilation? b. 13. a. 21. 20. Describe about Nondeterministic and Deterministic finite automata. 17. 16. Compiler – construction tools b. Question Bank 11. What are the two parts Obtain the minimized state DFA for the regular expression (a/b)*a using subset construction method. Write the algorithm to convert from NFA to DFA. } Identify and eliminate induction variables in the same. 15. of Information Technology . 10. j). Write short notes on the following: a. Discuss the issues in code generation with examples. Explain the principal sources of optimization with example. 19. a. 22. Precedence of operators 23. Construct the predictive parser for the following grammar E ® TE’ E’ ® +TE’ | e T ® FT’ T’ ® *FT’ | e F ® (E) | id Describe the different error recovery techniques. 24. n). Type exression Synthesized and inherited attributes. 34. 39. Question Bank 28. 27. 31. b. List the rules for constructing Regular expressions. Consider a simple programming language. Explain in detail about the compiler construction tools. a. Construct the minimum state DFA for the regular expression a (b | c)* Construct a SLR parsing table for the grammar Karunya University | Dept. Write regular expressions for tokens and draw atransition diagram for recognition of these tokens. What is different storage – allocation strategies? Explain any two allocation strategies in detail. Write note on data structures for Symbol table implementation. of Information Technology . E→E+T|T T→T*F|F F → ( E ) | id Explain in detail the various phases of compilers with an example. 30. 38. Structure – preserving transformation Basic Blocks Explain syntax directed definition for a simple translating expression. Construct NFA and then find out DFA for regular expression (a/b)*abb. 36. List out the Algebraic properties of regular expressions in a table. Describe LR parsing algorithm. 32. 40. Give an example. 29.Compiler Design 26. a. a. 35. b. b. What are compiler construction tools? Write note on each Compiler-Construction tool.. 37. Describe the following a. b. 33. Convert the given regular expression (a | b)*abb (a | b)* into NFA using Thompson construction and then convert to minimized DFA. Construct Operator Precedence Relation function for the following Grammar. Explain different issues in the design of a code generator Describe the following: a b. Convert the given regular expression (a | b )*abb( a | b)* into NFA using Thompson construction and then to minimized DFA. 45. E ® E+T|T T ® TF | F F ® F*|a|b Explain in detail the various phases of compilers with an example. 55. Elaborate on the peephole optimization. Draw syntax tree and DAG for a + a * (b – c) + (b – c) * d. Construct predictive parsing table for the grammar and parse the string (0 or 1)$ E ® E or E |E and E | not E |(E) | 0 | 1 52. 42. 53. Discuss in detail the cousins of compilers. Explain stack and heap allocation. Construct LALR(1) parsers for the following grammar. Discuss about the storage allocation strategies.Compiler Design Question Bank 41. Discuss in detail about run time storage management. Explain the various issues in the design of code generation. Using that draw annotated parse tree for 3 * 5 + 4n. 50. S→S(S) S→ε 46. Explain syntax directed translation to draw syntax tree. a. Construct SLR parsing table for the grammar and parse the string ( )( )$. b. 51. Construct the DAG for the following basic block d:=b*c e : = a +b b:=b*c Karunya University | Dept. b. a. 54. 48. of Information Technology . Construct a DFA directly from an augmented regular expression ( ( e | a) b* )* 44. Explain about activation records. 49. S → L=R S → R L → *R L → id R → L 47. Explain in detail about loop optimization techniques. Explain syntax directed definition of a simple desk calculator. 43. a. Explain briefly about the storage allocation strategies. a. Construct the predictive parsing table for the following grammar and parse any one of the strings. Construct the NFA for the regular expression 011(0 | 1)* using Thompson method and convert it into minimized DFA. 57. 68. Explain with an example about the optimization of basic blocks. 60. 69. 59. a. Karunya University | Dept. Also write down the output for the following expression after each phase. Write code to generate intermediate code for Boolean expression with back patching. b. 63. Explain briefly about the compiler construction tools. S → CC C → cC C→d 61. 66. 67. of Information Technology . Give an example. Write the syntax directed translation for declarations. Explain the various phases of a compiler in detail. Explain briefly about the design of Lexical Analyzer generator with its suitable diagram. Write a note on front end and back end of the compiler. b. b. Draw NFA for the regular expression ab* / ab. Write an algorithm to convert NFA to DFA and minimize DFA. 64. What is an ambiguous grammar? Is the following grammar ambiguous? Prove. Explain the various compiler construction tools in detail. be -> be or bt / bt bt -> bt and bf / bf bf -> not bf / (bf) / true / false 65. Write down the implementation of 3-address code with an example. Write down the issues involved in code generation. E → E + E | E * E | (E) | id 62.Compiler Design Question Bank a:=e–d 56. Discuss the issues involved in designing Lexical Analyzer. b. 58. b. position: = initial + rate*60. a. a. Write an algorithm to construct SLR parsing table with all sub routines. Construct the SLR parsing table for the following grammar. 85. 79. Explain briefly about Intermediate Languages and its implementation. Define Token. 77. 72. a)). Explain the issues in the design of code generator. 81. Convert NFA for (a|b)* for DFAs. What is a three address code? List the common three address instruction forms. State the reasons for LR parsers. 84. Describe briefly about the construction of syntax tree using syntax directed definitions. (a. Describe briefly about YACC parser generator. 87. 88. 76. Construct minimum state DFA for the following regular expression (a ‫ ׀‬b)* a (a ‫ ׀‬b). 74. Explain the phases of compiler. Explain LR parsing algorithm. 75. 82. Consider a grammar S → (L) | a L → L. of Information Technology . What are the terminals. Explain syntax directed translation schemes. Construct an LR parsing table for the following grammar Karunya University | Dept.Compiler Design 70. Show the sequence of moves made by each in processing the input string ababba. 78. Define parsing. b. S | S i) ii) 71. 83. What is data flow analysis? Explain data flow abstraction with examples Write in detail about syntax-directed translation with an example. Explain the types of parsing with example. Discuss briefly about the issues in the design of code generator. non-terminals and start symbol? Question Bank Construct leftmost and rightmost derivations of the corresponding parse trees for the following sentence (a. What is a grammar? Explain with example about the ways to eliminate ambiguity. Explain with suitable example about how the tokens are specified? What is a finite automata? Explain DFA and NFA with examples. 80. Explain briefly about the principal sources of optimization. 86. 73. a. Compiler Design a. 93. SJF. d. non-preemptive priority (lower number implies higher priority) and RR (time quantum = 1) scheduling. Consider the following set of processes. Explain in detail about interprocess communication. Syntax directed definitions Storage allocation strategies Write and discuss the specification of simple type checker for statements. 97. T -> T*F F-> id Question Bank 89. Discuss about basic blocks with an example. Explain the non-recursive implementation of predictive parsers with the help of the grammar E-> E+T|T T->T*F|F F->(E)|id 90. expressions and functions. P3. with the length of the CPU-burst time given in milliseconds: Process Burst time Priority P1 10 3 P2 1 1 P3 2 3 P4 1 4 P5 5 2 Processes are arrived in P1. 91. P2. 94. Karunya University | Dept. P5 order of all at time 0. f. 96. E -> T F -> (E) c. 95. Explain about the Banker's algorithm for deadlock avoidance. Write about runtime storage management. Explain how protection is provided for the hardware resources by the operating system. b. E -> E + T T -> F b. 92. 98. Also calculate waiting and turnaround time of each process for each one of the above scheduling algorithms. e. Explain about the various systems calls. Draw Gantt charts to show execution using FCFS. Write short notes on the following: a. P4. of Information Technology . 107. 2. 1. S → iEtS‫׀‬iEtSeS‫׀‬a E→b 110. 4. Discuss the phases of compiler with the help of the statement p: = initial + rate × 60. Briefly explain about the single and two level directory structures. Construct minimum state DFA for the regular expression (a ‫ ׀‬b)* a(a ‫ ׀‬b). Explain about the basic concepts of paging. Consider the following page-reference string 1.Compiler Design 99. 5. 3. 108. Construct a predictive parser for the following grammar bexpr → bexpr or bterm ‫ ׀‬bterm bterm→ bterm and bfactor ‫ ׀‬bfactor bfactor→not bfactor (bexpr)‫׀‬true‫׀‬false 109. 7. 104. 102. 6. FIFO replacement 101. 3. Explain SSTF. b. assuming three frames? Remember all frames are initially empty. 6. 100. Check whether the following grammar is LL(1) or not a grammar. Construct the DFA’s for the regular expression (a* ‫׀‬b*)* abb (a‫׀‬b)*. LRU replacement c. Optimal replacement a. 2. 2. 105. Consider the following grammar and construct the SLR parsing table E → E +T ‫ ׀‬T T → TF ‫ ׀‬F F →F * ‫ ׀‬a ‫ ׀‬b Karunya University | Dept. C-SCAN and LOOK disk scheduling techniques with examples. a. 103. SCAN. 6. 1. 2. 106. Discuss about the kernel I/O subsystem. b. 3. 2. 1. 3. Explain in detail about compiler construction tools and cousins of the compiler. Write notes about the protection strategies provided for files. 2. of Information Technology . Question Bank How many page faults would occur for the following replacement algorithms. explain the method of converting a NFA into a DFA. h. Give an overview of shift reduce parsing and write the issues in it. Can you minimize the number of states of DFA? Write an algorithm to minimize and justify your answer with examples. Explain basic blocks and their optimization. 122. With a neat diagram. With examples. 123. of Information Technology .Compiler Design 111. a. Explain the generic issues in the design of code generators. 113. f. 118. 112. Explain the two types of bottom up parsing with examples. Question Bank Discuss in detail about function preserving transformation technique with suitable example. a. e. 119. Briefly list and state the various compiler construction tools. Briefly explain the types of three address code with implementation. explain the various phases of a compiler. t1:=4*i t2:a[t1] t3:=4*i t4:=b[t3] t5:=t2*t4 t6:=prod + t5 prod := t6 t7 := i+1 i:= t7 if i<=20 go to (1) 114. Karunya University | Dept. Write an algorithm for construction of DAG and construct the DAG with the following three address code of dot program. b. i. Define a Directed Acyclic Graph. d. c. 121. 115. Construct a DAG and write the sequence of instructions for the expression a + a * ( b – c ) + ( b – c ) * d . j. 116. 120. Explain in detail about intermediate languages with example. 117. Write a short note on the syntax directed translation for assignment statements. b. g. Discuss with an example about the optimization of basic blocks. Discuss the phases of compiler with the help of the statement p: = initial + rate × 60. 125. Explain about the various storage allocation strategies. Write short notes on compiler construction tool. Discuss about context free grammar and give an example for leftmost and rightmost derivations. Explain the concept of Type Systems in detail. 135. trace the output of each phase for the program segment. 127. (a ‫ ׀‬b)* a(a ‫ ׀‬b) Construct the DFA’s for the following regular expression.Compiler Design Question Bank 124. triples and postfix form. Translate a=b*-c+b*-c into three address statements. 134. 131. 137. where rate is a real data type. Write an algorithm to construct an SLR parsing table with all subroutines. 136. Explain the Compiler construction tools. 126. 133. Construct minimum state DFA for the regular expression. 132. 126. b. quadruples. Construct the predictive parsing table for the grammar and parse the statement: not (true or false) Productions: E ® E or T | T T ® T and F | F F ® not F| (E) |true|false 128. 129. Describe the various phases of a compiler in detail. position = initial + rate *60. Convert the regular expression (a|b)*abb into NFA. a. Write the algorithm to convert a regular expression to a DFA and explain this with an example. ( a* ‫׀‬b*)* abb (a‫׀‬b)* Construct a predictive parser for the following grammar bexpr → bexpr or bterm ‫ ׀‬bterm Karunya University | Dept. 130. Elucidate about the cousins of the compiler. reduction and ambiguity. Then convert the respective NFA to DFA and minimize it. of Information Technology . 145. Discuss about the various intermediate languages. Explain the Specification of simple type checker for statements. What are the phases of the Compiler? Explain with a neat diagram. a. Define Compiler. What is DFA? What are the conditions to be satisfied for NFA? What is meant by recognizer? 144. What are Compiler construction tools? Explain its specifications in detail. Define regular expression. g. a. 140. t1:=4*I t4:=b[t3] prod := t6 b. a. t2:a[t1] t5:=t2*t4 t7 := i+1 c. d. b. . h. a. a. c. 141. Give the algebraic properties of regular expression. Explain about runtime storage management. Define LL (1) grammar. Construct a finite automata that will accept a string of zeros and ones that contains an odd number of zeros and an even number of ones. Give the rules in regular expression. What are the possibilities of non-recursive predictive parsing? Karunya University | Dept. b. f. 142. Question Bank Consider the following grammar and construct the SLR parsing table E → E +T ‫ ׀‬T T → TF ‫ ׀‬F F →F * ‫ ׀‬a ‫ ׀‬b 139. Write an algorithm for construction of DAG and construct the DAG with the following three-address code of dot program. a. if i<=20 go to (1) 143. b. 144. c. of Information Technology 146. expressions and functions. i. e. d. b. Write a short note on Token Patterns and Lexemes. t3:=4*I t6:=prod + t5 i:= t7 j. b.Compiler Design bterm→ bterm and bfactor ‫ ׀‬bfactor bfactor→not bfactor (bexpr)‫׀‬true‫׀‬false 138. Give the precedence of regular expression operator. What are the three techniques for constructing LR parsing table? 148. 156. 157. 149. Discuss about the principle sources of code optimization. Discuss about the process. G: S ®AS S®b A®SA A®a b. 150. 147. Why LR parsing is good and attractive? What are the different storage allocation strategies? Explain. Explain the sequence of stack allocation process for a function call. a. Explain the various source language issues.Compiler Design c. Write syntax directed definition to implement of a desk calculator with an LR parser and show the evaluation of expression ‘95*4 +5’. of Information Technology . a. i = i+1. Question Bank Define LR (0) items. 153. 151. 154. Write short notes on conventional compilers. Find the item I0 for the following grammar using CLR parsing method. d. } Construct a predictive parsing table for the following Grammar S → iEtSS’ | a S→ eS/ε E→ b and show the parsing of input“ ibtaea”. Write note on Runtime storage Management. Generate the Three-address code for While(i<10) { x = 0. 152. Karunya University | Dept. b. 155. Describe the various phases of a compiler in detail. Trace the output of each phase for the program segment position: = initial+ rate*60 where rate is real data type. which supports for compilation.
Copyright © 2024 DOKUMEN.SITE Inc.