Sample Question of Compiler For RTU
Sample Question of Compiler For RTU
1. Define parser.
2. Mention basic issues in parsing
3. Why lexical and syntax analyzers are separated out
4. Define CFG?/what do you mean by CFG?
5. Define the terms language translator and compiler
6. What is a flow graph? Explain with example
7. List out different object code forms.
8. Differentiate abstract syntax tree and DAG representation of intermediate code
9. Define left recursion. Is the following grammar left recursive? EE + E/E * E/ a/ b
10. What is hashing?
11. What is Lexical analyzer?
12. What do you mean by activation record?
13. Give the full form and definition of DFG?
14. What is Intermediate code?
15. What is input buffering?
16. What is YACC error handling in LR Parser?
17. Difference between Bottom-up and Top-down parsing?
18. What do you mean by peephole optimization / define optimization?
19. Explain different types of errors in compilers and how to handle by error handler?
20. Define finite automata and regular expression?
21. Differentiate between compiler and interpreter.
22. What is Bootstrapping?
23. What is translator ?
24. What is token?
25. What is syntax?
26. What is ambiguity?
PART-B
1. Define LL(1) grammar. In the following grammar LL(1)
G: Si E t S / i E t S e /a ; E b
Also write the rules for computing FIRST() & FOLLOW().
2. What is LALR(1) grammar ? construct LALR parsing table for the following grammar
ScC, CcC, Ce/d
3. Explain the usage of YACC parser generator in construction of parser
4. Why do we need syntax tree when constructing compiler
5. Explain the various compiler phases in brief with suitable example
6. What is the process & importance of intermediate code generation
7. Explain various strategies of symbol table creation & organization
8. Describe bootstrapping in detail
9. Write short note on operator precedence parsing function.
10. What do you mean by basic block? Also explain in detail the transformation in basic block.
11. Construct a DAG for the basic block whose code is given below:-
D := B * C
E := A + B
B := B * C
A := E – D
12. Explain in brief the various issues of design of code generator.
13. What is the basic task of scanning? What are the difficulties found in delimiter oriented
scanning? How can this be removed?
14. Explain the syntax directed translation schemes in detail.
15. Consider the expression (Left to right scanning )-
(a/b*c) + (a/b) – (b+(a*b))(a*b)
Draw the DAG of the above expression.
16. What do you mean by LR parser? What is the model of an LR parser ? explain .
17. Construct NFA to accept a(a/b)*b
18. Classify the errors and discuss the errors in each phase of compiler.
19. What is symbol table? Write the procedure to store the names in symbol table.
20. Explain bottom up parsing?
21. Write short note on global data flow analysis
22. Explain intermediate code forms using postfix notation.
23. What is peephole optimization? Explain in detail
24. Consider the grammar
EE+E
EE*E
E id
Perform shift reduce parsing of the input string “id1 + id2 + id3”.
PART-C
1. Writing short notes on
a. Nesting dept & access link
b. Data structures used is symbolic table
c. Static versus dynamic storage allocation
2. What is LEX? Discuss the usage of LEX in Lexical Analyzer generation
3. Generate the three address code for the following code fragment
while(a > b)
{
if( c > d)
x = y + z;
else
x = y – z;
}
4. Explain the different storage allocation strategies.
5. Explain the following terms:-
i. Register descriptor
ii. Address deecriptor
iii. Instruction costs
6. Consider the following grammar G :-
E E + T | T
T TF | F
FF*|a|b
a. Construct the SLR parsing table for this grammar.
b. Construct the LALR parsing
7. Define syntax directed definition. Explain the various forms of syntax directed definition.
8. Translate the arithmetic expression:-
(a + b) * (c + d) + (a + b + c) into
a. Syntax tree
b. Three address code
c. Quadruple
d. Triples
9. Consider the following basic block and then construct the DAG for it
t1 = a + b
t2 = c + d
t 3 = e – t2
t4 = t1 - t3
10. Explain different storage allocation strategies
11. Consider the following LL(1) grammar describing a certain sort of rented lists:-
S TS|Ꜫ
T U.T|U
U x|y|[s]
i. Left factor this grammar
ii. Give the first and follow sets for each non-terminal in the grammar obtain in part(i).
iii. Using this information construct an LL parsing table for the grammar obtain in part(i).
12. (a) Calculate canonical collection of sets of LR(0). Items of grammar given below:-
E’ E
E E + T| T
TT*F|F
F (Ꜫ) | id
(b) Calculate canonical collection of sets of LR(1). Items of grammar given below:-
s’ s
s cc
c ec/d
13. For the assignment statement X = (a + b) * (c + d), construct the translation scheme and an
annotated parse tree. Also, differentiate between ‘call by value’ and ‘call by reference’ with
example.
14. Explain peephole optimization in detail .
15. Explain the symbol table management system in detail.
16. Explain parsing techniques with a hierarchical diagram.
17. Construct syntax tree and postfix notation for the following expressin
(a + (h * c)^ d – e / (f + g ))
18. What is common sub expression and how to eliminate it? Explain with the help of appropriate
example.