PRINCIPLES OF COMPLIER DESIGN (POCD) – Question Bank (All Units)

Anna University

DEPARTMENT OF COMPUTER SCIENCE ENGINEERING

QUESTION BANK


SUB.NAME : PRINCIPLES OF COMPLIER DESIGN

SUB.CODE : CS2352


YEAR: III

SEMESTER: VI


UNIT I


2 Marks

1. Define compiler

2. Distinguish between compiler and interpreter

3. Define translator

4. What do you mean by assembler and preprocessor

5. Define macro processor

6. Define phase

7. What is the purpose of scanner?

8. Define token and lex eme

9. Define parser

10. What do you mean by syntax tree (parse tree or derivation tree)?

11. What are the advantages and disadvantages of intermediate language?

12. Define sentence

13. Define terminal symbol and non -terminal symbol

14. Define derivation and reduction

15. Define contex t free grammar

16. Define production rule (or rewriting rule)

17. Define ambiguity

18. What do you mean by ambiguous grammar?

19. Define recursive grammar with types

20. Define conflict

21. What do you mean by look ahead symbol?

22. Define handle and linear grammar

23. Define regular expression

24. What do you mean by canonical derivation

25. What do you mean by canonical sentential form

26. What is the purpose of precedence relation?

27. What is an important task done by lexical analyzer or scanner?

28. What are the tasks done by scanner other than token generation?

29. What are the reasons for separating the analysis phase to lexical analysis and parser?

30. Define pattern and lexeme

16 Marks

1. Explain the role performed by lexical analysis of the compiler.

2. Write grammar for the following languages the set of non -integers with no leading zeros.

3. Explain the need of code optimization in compiler

4. Write note on front and back end of compiler

5. Write a context free grammar that generates all numbers; numbers can be integer or real.

6. Explain the phases of compiler

7. Explain Symbol table management and error handling

8. Explain construction tools in compiler

9. Explain cousins of compiler

10. Explain the need of intermediate code generator and write the grammar for the following languages set of non-negative odd integers.

1. Define attribute

2. Define panic mode


UNIT II

2 Marks

3. Write down the possible error recovery actions taken by lexical analyzer.

4. Define character class and language

5. What are the operations supported by a string

6. What are the common operations in a language?

7. What do you mean by subsequence?

8. What is the purpose of the following notations , + and ?

9. Explain the notation useful f or character class

10. What is the purpose of transition diagram?

11. Define the purpose of gettoken( ) function

12. Define the purpose of installid( ) function

13. Define Look ahead operator.

14. Define Finite automata.

15. Define NFA

16. Define DFA

17.Write down the structure of LEX program.

18. What are the Types of Parsers

19. What do you mean by shift reduce parsing?

20. Define Handle pruning

21. State the goals for error handler in parser

22. How the handles are identified in parsing?

23. What are the different actions of parser?

24. Define operator grammar

25. Define operator precedence grammar

26. What are the different precedence relations in operator precedence parser?

16 Marks

1.Consider the grammar

S->(L)| A L->L,S|S

a) What are the terminals, on terminals and start symbol b) find parse tree for (i)(a,a)

(ii) (a,(a,a) (iii)(a,((a,a),(a,a)))

2.Explain LR parsers

3.Explain how to construct SLR parsing tables with ex ample

4.ex plain top down parsing

5.ex plain bottom up parsing

6.Explain error recovery in operator precedence parsing

7.Write a contex t free grammar that generates all palindrome of a’s and b’s. palindrome is the string that reads the same.

8.Explain SLR parser.

9.Explain syntax directed definition

10.construct unambiguous grammar for the statement with example

11.define LL(1) grammar with ex amples

12.Check whether the following grammar is SLR(1) or not

S->L=R S->R

L->*R L->id R->L


UNIT III

2 Marks

1. Define left recursion

2. Define left factoring

3. How will you eliminate left factor?

4. Define recursive descent parsing.

5. Define predictive parser

6. Define LL(1) Grammar

7. Write down the different intermediate languages.

8. What are the different implementation methods for three-address code?

9. What do you mean by quadruple?

10. Define triple

11. Define indirect triple

12. Write down the benefits for using an intermediate language

13. Define three-address code.

14. Write down any four common three -address statements.

15. Define translation scheme

16. What are the different methods are available to translate Boolean expressions?

17. Define short circuit code

18. Define back patching.

19. What are the functions available to manipulate labels.

20. What is the purpose of the symbol M in the grammar?

21. Define the purpose of code generator.

22. List down the generic issues in the design of code generators.

23. What are the problem s occur during the use of registers?

24. What do you mean by symbol table?

25. When the symbol table entries are used?

26. Define semantic analysis.

27. Define syntax analysis

28. Write down the steps in analysis phase.

29. What do you mean by linear analysis?

30. Define hierarchical analysis ?

16 Marks

1. Define left recursion

2. Define left factoring

3. How will you eliminate left factor?

4. Define recursive descent parsing.

5. Define predictive parser

6. Define LL(1) Grammar

7. Write down the different intermediate languages.

8. What are the different implementation methods for three-address code?

9. What do you mean by quadruple?

10. Define triple

11. Define indirect triple

12. Write down the benefits for using an intermediate language

13. Define three-address code.

14. Write down any four common three -address statements.

15. Define translation scheme

16. What are the different methods are available to translate Boolean expre ssions?

17. Define short circuit code

18. Define back patching.

19. What are the functions available to manipulate labels.

20. What is the purpose of the symbol M in the grammar?

21. Define the purpose of code generator.

22. List down the generic issues in the design of code generators.

23. What are the problem s occur during the use of registers?

24. What do you mean by symbol table?

25. When the symbol table entries are used?

26. Define semantic analysis.


UNIT IV


2 Marks

1. Define translation scheme

2. What are the different methods are available to translate Boolean expressions?

3. Define short circuit code

4. Define back patching.

5. What are the functions available to manipulate labels?

6. What is the purpose of the symbol M in the grammar?

7. Define the purpose of code generator.

8. List down the generic issues in the design of code generators.

9. What are the problem s occur during the use of registers?

10. What do you mean by symbol table?

11. When the symbol table entries are used?

12. Define semantic analysis.

13. Define syntax analysis

14. Write down the steps in analysis phase.

15. What do you mean by linear analysis?

16. Define hierarchical analysis

17. Write down some examples of conventional compilers.

18. Define front end

19. Define back end

20. What do you mean by syntax directed translation?

21. What is the reason for the ‘term three address code’?

22. How the conditional jump and unconditional jumps are specified in three address code?

23. Write down the partial expression evaluated during running time for one and two dimensional arrays

24. What do a* and a+ refer to in a regular expression?

25. What is the purpose of symbol table?

26. Represent the given statement as a triple and a quadruple x := y op z

27. Define triple

28. Define indirect triple

16 Marks

1. Explain how the intermediate codes are generated for Boolean expression s

2. Explain in detail about back patching

3. Explain the issues in the design of code generator

4. Explain in detail about run time storage management

5. Explain the simple code generator

6.Explain peephole optimization

7. Ex plain the term “nesting depth” with some suitable example

8 Explain Hash tables

9 Give sub division of run time memory

10 Explain dynamic scoping.


UNIT V


2 Marks

1. Define Runtime Environment?

2.Define Activation tree?

3.Define Flow graph?

4.What do you meant by loop

5.Explain peephole optimization

6.Define procedure calls

7.Give characteristics of peep hole

8.What do you meant by Algebric simplification?

9.what is the need of sub expression?

10.Define dead code?

11.Define reduction in strength?

12.Define DFS

13.Define Copy propagation?

14.What is the advantage of Copy propagation?

15.What is Code motion?

16.What is scope of declaration?

17.What is storage organization?

18.what are all division and sub storage?

19.Define Activation records?

20.What is the purpose of activation record?

21.what are storage allocation strategies?

22.What is static allocation?

23.Give limitation of static allocation

24.Define stack allocation?

25. Define back patching?

26. List down the generic issues in the design of code generators.

27.Define calling sequence?

28.Define Heap allocation?

29.Define deallocation?

30.What are the processes of optimizing compiler?

16 Marks

1. Explain code optimization in detail

2.Discuss in detail about run time management

3.Explain Heap allocation

4 Explain stack allocation

5.Explain induction variable end reduction strength

6.Explain deadlock elimination

7.Explain storage allocation strategies

8.Explain control stacks

9.discuss in detail about activation records

10.Explain the various structures used in Symbol table construction