You are on page 1of 2

CS1352-Principles of Compiler Design Question Bank PART-B Unit-I 1) With a neat block diagram, explain the various

phases of a compiler in detail. Assuming an expression give the output of each phase. 2) Explain input buffering in detail. 3) Construct a DFA for the given regular expression using subset construction method. Also minimize the number of states ( a / b ) * a bb 4) Explain in detail about the role of lexical analyzer with the possible error recovery actions. 5) Explain in detail the cousins of the compiler. 6) What are the compiler construction tools. Explain. 7) Define regular expressions? What are the rules that define regular expressions over alphabet E ? 8) Write short notes on a) tokens, patterns and lexemes b) regular definitions c) transition diagrams. 9) What are Lex and Lex specification ? How lexical analyzer is constructed using lex? Write a Lex program that recognizer the tokens. 10) Construct NFA for (a/b)* and convert into DFA. Unit-II 1) Construct a predictive parsing.table for the grammar E -> E + T / F T -> T * F / F F -> (E) / id 2) Give the LALR parsing table for the grammar. S -> L = R / R L -> * R / id R -> L 3) Consider the grammar E -> TE’ E’ -> + TE’ / E T -> FT’ T’ -> *FT’ / E F -> (E) / id Construct a predictive parsing table for the grammar shown above. Verify whether the input string id + id * id is accepted by the grammar or not. 4) Consider the grammar. E -> E + T E -> T T -> T * F T -> F F -> (E) / id Construct an LR parsing table for the above grammar. Give the moves of the LR parser on id * id + id 5) For the grammar given below, calculate the operator precedence relation and the precedence functions E -> E + E | E – E | |E*E|E|E| | E ^ E | (E) | | -E | id 6) Compare top down parsing and bottom up parsing methods. 7) What are LR parsers? Explain with a diagram the LR parsing algorithm. 8) What are parser generators?

What are the questions to be asked to understand how a compiler must organize its storage and bind names. 3) Explain about the different types of three address statements. 9) What is a three address code? Mention its types. Explain. 5) What is back batching? Explain with an example. 10) Compare SLR. What are different storage allocation strategies. Compare them. LALR and LR parses. . Explain in detail various methods of passing parameters Explain peep hole optimization with suitable examples. Unit-IV 1) 2) 3) 4) 5) Discuss in detail about the run time storage arrangement. 9) What do you me an by machine dependent and machine independent optimizations? 10) Give an algorithm to construct DAG from given basic block. 4) What are the methods of translating Boolean expressions. 7) What is an activation record? What are its fields represent? 8) Write about data flow analysis of structured program. How would you implement these address statements? Explain with suitable examples. 6) Explain procedure call with an example. Example. 7) How assignment statements are translated into three address code? 8) Explain how declarations are done in a procedure using syntax directed translations. Write in detail about the issues in the design of code generator. Describe in detail the optimization of basic blocks with an example. 10) Write syntax directed translation for arrays. What are activation trees? Construct an activation tree for quick sort. Unit-III 1) How would you generate intermediate coder for the flow of control statements? Explain with examples. 2) Explain various data structures used for symbol table construction.9) Explain recursive descent parser with appropriate examples. Discuss briefly about DAG Explain in detail about primary structure processing transformations of basic Unit-V 1) 2) 3) 4) 5) 6) Explain in detail about principal sources of optimization.