You are on page 1of 2

Theory Questions for Unit- 1& 2 Q17.

Write the algorithm to design a predictive parsing


Q1. What do you mean by compiler & its cousins? table. Also explain the LL (1) Grammar.
Explain the functioning of various phases of compiler. Q18.What is non recursive predictive parsing? Explain
Q2. Describe the analysis and synthesis model of its algorithm.
compilation. Q19. Explain Thompson algorithm to construct NFA
Q3. Explain the term cross compiler & bootstrapping. from regular expression.
How the bootstrapping of a compiler to more than one Q20. Explain the steps to convert an NFA to DFA.
machine is done? Q21) Explain shift reduce parsing and its conflicts.
Q4. What is a Pass? Also explain single-pass and multi- Consider a grammar and input string and show the
pass compiler. configuration of shift reduce parser for that.
Q5. What do you understand by lexical analyzer Q22) Explain the algorithm for computing precedence
generator and LEX compiler? function with example.
Q6. Discuss the YACC parser generator. Also explain Q23) Explain Operator Precedence parsing algorithm.
the format of input specification file. Consider the following grammar and build up operator
Q7. Explain the token, lexeme and pattern with precedence table. Also parse the input string id+id*id.
example. G: EE+E, EE*E, Eid
Q8. Explain the techniques used in token recognition Q24) what is LR parsing. Explain LR parsing algorithm.
and token specification (transition diagrams) with Q25) write the algorithm to construct SLR & LALR (1)
example. parsing table.
Q9.Explian the buffering schemes used in lexical Q26) Discuss the algorithm for computation of set of LR
analysis process/scanning of source program. (0) items & L (1) items.
Q10.Define the parse tree and derivation tree with
example. Theory questions for Unit-3
Q11. What is top down parsing? State the problems Q1) what is intermediate code? Also explain
associated with top down parsing- properties and advantages of intermediate code.
a) Backtracking b)Left factoring c)Left Explain the various categories of intermediate
recursion algorithm d)Ambiguity codes & their implementation with examples:
Eliminate the problems associated with following Q2) Explain various implementation schemes of
grammar for top down parsing three address code:
EE+T | T, ET*F | F, F (E) | id a) Quadruples b) Triples c) Indirect
Q12) consider the following grammar triples
E EBE , Enum , E (E) Q3) Consider the following SDTS
B + | - | * | / E E1 * T {E.val = E1.val * T.val}
a) Explain why following grammar is not suitable ET {E.val = T.val}
for basis of a recursive descent parser. TT1 F {T.val = T1.val F.val}
b) Use left factoring and left recursion to obtain an TF {T.val = F.val}
equivalent grammar which can be used as the F2 {F.val = 2}
basis for recursive descent parser.
F4 {F.val = 4}
Q13. What is ambiguous grammar? How ambiguity can
Using above SDTS construct annotated parse tree
be checked? How the ambiguity of a grammar can be
for expression: 4 - 2 - 4 * 2, also compute the value
removed?
of E.val.
Q14. Explain: a) Context free grammar b) BNF
Q4) Write short notes on the followings with
notation
examples
Q15. Differentiate between recursive descent parsing
a) Back patching b) Abstract Syntax
and predictive parsing techniques.
Tree c) DAG d) Dependency Graph
Q16. Explain the algorithm to compute FIRST and
Algorithm
FOLLOW set of a given grammar.
Q5) consider the following grammar
EE+T|T, TT*F|F, F (E) |id, associate e) Classification of errors
semantic rules with productions to construct a f) Error recovery schemes
syntax tree for an expression. Using translation
Theory questions for Unit-5
scheme construct the parse tree for expression a +
Q1) Define code optimization. Explain need of code
b * c.
optimization. Also explain machine independent code
Q6) Translate the statement X: = A [i, j] where lower
optimization.
bounds of i & j both are 1 and upper bounds are 10
Q2) Explain principle sources of code optimization /
and 20 respectively.
code optimization techniques with example.
Q7) Write the details about syntax directed
Q3) Discuss loop optimization techniques with example.
translation scheme and explain the following with
Q4) Define basic block. Explain the algorithm for
example-
partitioning a sequence of three address code into
a) Synthesized attributes b) Inherited
basic blocks. Illustrate with example.
attributes c)Annotated parse tree d) L-
Q5) Explain how optimization of a basic block is done?
attributed definitions
Also explain structure preserving transformation and
Q8) Consider the following grammar productions
use of algebraic identities.
EE + T
Q6) what is a flow graph? Explain the type of loops
EE T
which may appear in a flow graph.
E T Q7) what is DAG? Explain the algorithm to construct
Tdigit DAG of a given basic block with example. How does it
Draw annotated parse tree for following expression help in eliminating common sub expression?
3 + 2 4. Associate semantic rules in given CFG. Q8) Write short notes on-
Q10) Write syntax directed translation scheme for a) Induction variable elimination
addressing array elements, assignment statements and b) Common sub expression elimination
flow of control statements or while loop constructs. c) DAG representation of basic blocks and
Theory questions for Unit-4 application of DAG
Q1) Explain the various storage management d) Control flow analysis
techniques available? What is their importance in e) Data flow analysis
f) Loop unrolling and loop jamming
compiler design? (Static allocation, stack allocation,
g) Design issues of code generator
heap allocation).
Q9) Explain global data flow analysis. Give iterative
Q2) what are the various types of errors that may
solution of data flow equations.
appear in compilation process? Explain the working of
Q10) Explain the algorithm for followings with example-
error handling phase of compiler.
a) Global and local common sub expression
Q3) what is symbol table? Explain entries of a symbol
elimination
table? Explain the data structure used in symbol table b) Induction variable detection and elimination
organization. Q11) Explain desired properties of code generation
Q4) what do you mean by lexical phase error, syntactic phase and design issues of a code generator.
phase error and semantic phase error? Explain various NOTE: Revise all numerical from notes properly.
error recovery strategies for each type of error.
Q5) what is parameter passing? Explain various
parameter passing techniques such as call by value call
by reference, call by name etc.
Q6) what is run time administration? Explain activation
record and display structure.
Q7) Write short notes on:
a) Access Link
b) Lexical scope of nested procedures
c) Scope information
d) Run time storage management

You might also like