Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
3. *What is code optimization? What are its advantages and give a detailed
description on loop optimization techniques?
Q. Consider the following piece of code and covert in to three address code, Basic
block and Flow graph.
ERROR RECOVERY
2. **Translate the assignment statement a[i] = b⋆c – b⋆d into quadruples, triples and
indirect triples.
4. What is DAG and construct syntax tree and DAG for the given expression?
a+a*(b-c)+(b-c)*d.
5. Write quadruple, triple, indirect triple for the statement a*-(b+c).
4. Write the SDD for the given context free grammar given below and design
the dependency graph and explain the evolution order for that.
S TL
T int
T float
T char
L L, id
L id
5. Write about syntax directed definitions.
7. Write the attribute grammar for the following grammar and also draw the
parse tree for the string w = float x, y.
decl -> type var-list
Type-> int / float
var-list -> id, var-list / id
8. Write the syntax directed definition for the following grammar and also
draw the annotated parsetree for the input string 3∗5+4n
L En
E E+T | T
T T∗F | F
F (E) | digit
2. *Compute the FIRST and FOLLOW sets for the following grammar.
S->iEtSS’/a
S’->eS/E
E->b
8. **Construct the predictive parser for the following grammar .Show the
moves made by the parser on the input i*i$
E TE’
E’ +TE’ | ε
TFT’
T’ *FT’ | ε
F (E) | id
Q.Construct LL(1) parsing table for the following grammar:
exp ->exp addop term / term
addop-> +/-
term ->term mulop factor / factor
mulop-> *
factor -> (exp) / number.
12.Explain the construction of SLR parse table for the following grammar and
show the moves made by parser on input i + i $
E E + T | T
T T F | F
F (E) | i
13. Construct the SLR parsing table for the given grammar.
S->L=R/R L->*R/id R->L
14.Explain the process of shift-reduce parsing on the i/p string id1*id2 for the
following grammar.
E E + T / T
T T∗F / F
F (E) / id
d) a [index] = 5 + 2 ;
2. ****Explain the different phases of a compiler with a neat diagram, showing the
3.***Explain about various data structures used in a compiler. Specify where they
are used.