Sie sind auf Seite 1von 3

PRINCIPLES OF COMPILER DESIGN Question Bank

UNIT 1 Part A
1. 2. 3. 4. 5. Define Compiler. How does compiler differ from Interpreter? Mention some of the cousins of the compiler. Draw a NFA for a*/b* List out any two compiler construction tools.

6. What is analysis and synthesis phase of a compiler? 7. Define non deterministic finite automata. 8. Define preprocessor. 9. Write down the phases of Compiler. 10. Define Tokens, Lexeme and attributes.
PART B

UNIT 2 Part A 1. Define syntax analysis. 2. What is CFG? Give an example. 3. Check whether the grammar is ambiguous or not. S -> aSbS / bSaS / 4. Eliminate left recursion from the following grammar. S Aa /b , A Ac / Sd 5. Left factor the following grammar. S iEtS / iEtSeS / a , Eb 6. List out various bottom up parsing techniques. 7. Define operator grammar. 8. List out the steps in LALR parser. 9. When a grammar is said to be a CLR grammar. 10.What do you mean by Handle pruning?

1. Explain in detail about the various phases of the compiler with a neat PART B sketch. (10) 1. Construct Predictive parsing table for the following grammar and 2. Give the output of syntax analyzer for the statement hence Check whether the given string is id+id*id accepted or not

p = i + r * 60 (4) 3. Write short notes on Cousins of compiler (6) 4. Briefly explain about the compiler construction tools
5. Explain about the input buffering technique. (6)

(16) (10) EE+T|T TT*F|F F(E)|id


2. Check whether the following grammar is SLR (1) grammar or not S L=R SR L*R Lid RL (16)

6. Construct DFA directly from the following regular expression ( a | b) * a (a | b) (16) 7. Construct DFA from the following regular expression ( a* / b* )* b (16) 9. Convert the following regular expression to DFA. Using direct method. (a/b)* abb (16 )

3. Construct the shift reduce parser for the following grammar and hence check whether the string ccdd is accepted or not. SCC CcC Cd 4. Construct the Predictive parsing table for the following grammar S (L) / a L L, S / S and parse the input is (a, a) (16) 5.Construct the CLR parsing table. S CC C cC C d Check whether the string cdcd is accepted or not. (16) 6. Construct the LALR parsing table. (16) S CC C cC C d 7. State the rules to compute FIRST and FOLLOW UNIT 3 Part A 1. 2. 3. 4. What is Back patching? What are the applications of DAG? List out the implementations of three address codes. How would you represent the following equation using DAG a =: b* -c + b*-c

6. Translate the following expression into three address code. S:=(a+b)*(d-f)/(e*g) 7. Draw the neat diagram for intermediate code generator. 8. What are the functions used in back patching? 9. Mention the types of three address statement. 10. Write down the formula for calculating an element in two dimensional array

PART B 1. Write about the implementation of three address statements. 8 2. Give the syntax directed definition for flow of control statements.8 3. How Back patching can be used to generate code for Boolean expressions .(10) 4. Write short notes on procedure calls. 6

5. Explain in detail about the intermediate languages 16 6. Explain in detail about the procedures and its translations into Intermediate codes 16 7. Explain how declarations are processed in a system. Explain clearly with attributes and nested declarations. (16) 8. How would you generate the intermediate code for the flow of control Statements? Explain with examples. 16

5. What is the intermediate code representation for the expression a or b and not c?

UNIT 4 Part A
1. How would you calculate the cost of an instruction? 2. How would you represent the following equation using the DAG a:=b * -c + b * -c.

UNIT 5 Part A
1. What is code motion?

3. Define DAG. 4. What are the applications of DAG? 5. Give the various storage allocation strategies. 6. What is meant by peephole optimization. 7. Define basic block. 8. Determine the cost for the following instruction c=a*b 9. When the temporaries can be packed? 10. Define code generation.
PART B 1.Explain in detail about the issues in the design of a code generator(10). 2. What are the steps needed to compute the next use information (6) 3. Discuss briefly about the DAG representation of Basic blocks? (8) 4.Explain the characteristics of peephole optimization.(8) 5.Explain Basic Blocks and Flow Graph with examples (8) 6. Explain about runtime storage management (8) 7.Explain about the various approaches to compiler development ()

2. Define activation record 3. Draw the diagram of the general activation record and give the purpose of any two fields. 4. Sketch the storage organization. 5. List out the various parameter passing techniques. 6. What is meant by code optimization? 7. Define Flow graph. 8. Write the rules to find out the leaders. 9. Define copy propagation. 10. What are live variables?
PART B 1. Discuss the principle sources of optimization (8) 2. Write about data flow analysis of structural programs.(8) 3. What are the different storage allocation strategies? Explain (10) 4. Write short notes on parameter passing (6) 5. Explain in detail about the symbol table (16)

6. Explain in detail how the non local variables are accessed? 16 7. Explain in detail about the organization of memory (8)