Anda di halaman 1dari 2

KCG College of Technology, Chennai-97

COMPUTER SCIENCE & ENGINEERING


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?
9) Explain recursive descent parser with appropriate examples.
10) Compare SLR, LALR and LR parses.

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. Compare them.
3) Explain about the different types of three address statements.
4) What are the methods of translating Boolean expressions.
5) What is back batching? Explain with an example.
6) Explain procedure call with an example.
7) How assignment statements are translated into three address code?
8) Explain how declarations are done in a procedure using syntax directed translations.
9) What is a three address code? Mention its types. How would you implement these address
statements? Explain with suitable examples.
10) Write syntax directed translation for arrays.

Unit-IV

1) Discuss in detail about the run time storage arrangement.


2) What are different storage allocation strategies. Explain.
3) Write in detail about the issues in the design of code generator.
4) Discuss briefly about DAG
5) Explain in detail about primary structure processing transformations of basic

Unit-V

1) Explain in detail about principal sources of optimization.


2) Describe in detail the optimization of basic blocks with an example.
3) Explain in detail various methods of passing parameters
4) Explain peep hole optimization with suitable examples.
5) What are activation trees? Construct an activation tree for quick sort. Example.
6) What are the questions to be asked to understand how a compiler must organize its storage and
bind names.
7) What is an activation record? What are its fields represent?
8) Write about data flow analysis of structured program.
9) What do you me an by machine dependent and machine independent optimizations?
10) Give an algorithm to construct DAG from given basic block.

Anda mungkin juga menyukai