CC Important Question Set

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Compiler Construction

Important Questions Set


UNIT I
1. Explain all phases of the compiler. Give all phase result for given statement

Position=initial+rate*60

2. Explain the following method of input buffering


a. Buffer pairs
b. Sentinels
3. Write a regular expression and construct transition diagram of the following
a. Identifiers and keywords in PASCAL
b. Unsigned numbers in PASCAL
4. Consider the following program:
main ()
{
int x,y,z;
z=x+y;
}

List down the lexemes, tokens and the attributes of the tokens at the end of the lexical
analysis.

5. What do you mean by compilation process? Explain the analysis-synthesis model of


compilation.

UNIT II

6. Write differences between bottom-up and top-down parsing with suitable example.
7. Construct the predictive parsing table for the grammar:

G= ({E, T, F}, {+,*, (,), id}, P, E) where

P: E―>E+T/T

T―>T*F/F

F―> (E)/id

8. Construct LALR parsing table for the given grammar

G= ({E, T, F}, {+,*, (,), id}, P, E) where


P: E―>E+T/T

T ―>T*F/F

F―> (E)/id

9. Write a short note on


a. Error recovery strategies that parser can employ to recover from syntatic error
b. Operator precedence parsing
c. LEX
d. YACC
10. Explain what is meant by shift reduce and reduce conflicts in bottom parsing and cosider
the grammar

S―> (L)/a

L―>L, S/S

Parse the input string (a, (a, a)) using shift reduce parser

UNIT III

11. Write syntax directed definition for given assignment statements:


S―>id: =E
E―>E+E/E*E/-E/(E)/id
12. Translate the arithmetic expression
- (a+b)*(c+d)+(a+b+c) into
a. Syntax tree
b. Three address code
c. Quadruple
d. Triples
e. Indirect triples
13. Write a short note on
a. Types of three address statements
b. Intermediate code generation
c. Synthesized attribute
d. L-Attributed Definition
e. Type expressions
14. Write a short note on static and dynamic checking of types
15. Consider the following grammar defining binary numbers:
binarynumber―> binarynumber binarydigit/binarydigit
binarydigit―>0/1
Write semantic rules for the above grammar using suitable attributes to compute the
integer value of the binary number.

UNIT IV

16. Write a short note on


a. Symbol table management system
b. Activation records
c. Storage allocation strategies
d. Dangling reference
17. What are the strategies of storage allocation in run time environment
18. Differentiate between actual and formal parameters and what are the various parameter
passing methods? Give examples
19. How symbol table is used by various phases of compiler
20. What is static and dynamic scoping and how variable data is stored in the activation
record?

UNIT V

21. “Code optimization is an optimal phase of compilation process.” Discuss in detail


22. Construct DAG for the basic block whose code is given below
t1=b+c
t2=d*e
t3=t2*t1
t4=t2*f
X=t1-t4
23. Write a short note on
a. Common subexpression elimination
b. Loop invariant computation
c. Dead code elimination
d. Variable propagation
e. Strength reduction
24. Explain in brief the various issues of design of a code generator.
25. What is peephole optimization and explain Global Data Flow Analysis.

You might also like