You are on page 1of 6

UNIT 1

1. Define following terms: i. Compiler ii. Interpreter iii.Token 03


2. Explain the roles of linker, loader and preprocessor. 03
3. Explain the language dependent and machine independent phases of compiler. Also List
major functions done by compiler. 07
4. What is compiler? What is front-end and back-end of compiler? 03
5. Explain input, output and action performed by each phases of compiler with example. 07
6. Explain phases of compilers with suitable example. 07

UNIT 2
1. Explain input buffering methods. 03
2. Draw the DFA for the regular expression (a|b)*abb using set construction method only. 07
3. Draw NFA from regular expression using Thomson’s construction and convert it into DFA.
(a | b)* a b* a 07
4. What is Input Buffering? Why it is used? 04
5. Describe the role of lexical analyzer. 03
6. Write the regular expression R over {0,1} or {a,b}:
1) The set of all strings with even number of a’s followed by an odd number of b’s.
2) The set of all strings that consist of alternating 0’s and 1’s . 04
7. Write a brief note on input buffering techniques. 04
8. Define token, lexeme and pattern. Identify the lexemes that makes up the tokens for the
following code
const p = 10;
if( a < p)
{ a++ ;
If(a== 5)
continue ;
} . 07
9. Construct deterministic finite automata without constructing NFA for following regular
expression. (a/b)*abb*. 07
10. What is lexical analysis? Which are the tasks performed by lexical analyzer. 03
11. Write a regular definition for:
1.The language of all strings containing at least one 0 and at least one 1.
2.The language of all strings that do not end with 01.
3.The language of all strings containing 0’s and 1’s both are even.
4.The language of all strings which are starting with 1 and ending with 0. 04

12. Write RE the following language..


1. All string of 0’s and 1’s that do not contain 11.
2. All string of 0’s and 1’s that every 1 is followed by 00. 03
13. Write a short note on input buffering techniques. 04
14. Define lexemes, patterns and tokens. 03
15. Construct a DFA for a given regular expression using syntax tree with firstpos, lastpos and
followpos function. (a|b)*a .07
16. Construct the NFA for following regular expression using Thompson’s construction. Apply
subset construction method to convert into DFA. (a+b)*abb# . 07

UNIT 3

1. Explain a rule of Left factoring a grammar and give Example. 07


2. Define the following terms and give suitable example for it. i. Augmented Grammar ii. LR
(0) Item iii.LR (1) Item. 04
3. Describe Ambiguous Grammar with example. 03
4. Design FIRST and FOLLOW set for the following grammar. 04
S→ 1AB | ε
A→1AC | 0C
B→0S
C→1
5. Explain operator grammar. Generate precedence function table for following grammar.07
E -> EAE | id
A -> + | *
6. Differentiate Top Down Parsing and Bottom up parsing. 03
7. Construct CLR parsing table for following grammar. 07
S -> aSA | €
A -> bS | c
8. Explain synthesized attributes with the help of an example.07
9. What are conflicts in LR Parser? What are their types? Explain with an example. 07
10. What do you mean by left recursion and how it is eliminated? 03
11. What is ambiguous grammar? Show that
S -> aS|Sa|a is an ambiguous grammar. 04
12. Consider the following grammar:
S’ = S#
S -> ABC
A -> a|bbD
B -> a| Ꜫ
C -> b| Ꜫ
D -> c| Ꜫ Construct FIRST and FOLLOW for the grammar also design LL(1) parsing table
for the grammar 07
13. Explain handle and handle pruning. 04
14. Consider the following grammar
S -> AA
A -> aA
A -> b And construct the LALR parsing table. 07
15. Differentiate between S attributes and L attributes. 03
16. For the following production write the semantic action:
S -> E$
E -> E1 + E2
E -> E1 * E2
E - > digit. 04
17. What is dependency graph? Explain with example. 04
18. Define Handle, Handle pruning, Ambiguous grammar. 03
19. Give the rule to remove left recursive grammar. And Eliminate left recursion from following
grammar. 04
S → Aa | b
A → Ac | Sd | f

20. What is left factoring in CFG? Perform the Left factoring of following Grammar. 04
S → iEtS / iEtSaS / a
E→b
21. Construct SLR parsing table for the following grammar :
S → (L) | a
L→ L,S | S .07
22. Give syntax directed definition for simple desk calculator. Also show annotated parse tree for
6*5+7n, .07
23. Define : 1) synthesized attribute 2) inherited attribute. 03
24. Differentiate ambiguous and unambiguous grammar. 03
25. Give the translation scheme that convert infix to postfix notation. 03
26. Define: Left Recursive Grammar. Check Following grammar is left recursive or not, if yes,
remove left recursive from it.
A → ABd / Aa / a
B → Be / b .04
27. Construct an SLR Parsing table for the following grammar.
S → Aa | bAc | bBa
A→ d
B → d .07
28. Explain shift reduce parsing technique in brief. 03
29. Differentiate top down parsing and bottom up parsing. 04
30. Show that the following grammar
S → AaAb | BbBa
A→ ϵ
B→ϵ
is LL(1) but not SLR(1). 07
31. Translate the arithmetic expression (a + b) * (c + d) into 1. Syntax tree 2. Postfix notation. 03
32. Show the following grammar is LR(1) but not LALR(1). 07
S->Aa │bAc │Bc│bBa
A->d
B->d

UNIT 4

1. Explain error recovery strategies used by parser. 04


2. Discuss the functions of error handler. 04
3. Explain the following with example 1) Lexical phase error 2) Syntactic phase error. 04
4. Explain error recovery strategies. 04
5. Explain Error Recovery Strategies in Compiler in brief. 04

UNIT 5

1. Translate following arithmetic expression


- ( a * b ) + ( c + d ) - ( a + b + c + d ) into
1] Quadruples
2] Triple
3] Indirect Triple. 07
2. Translate the following expression into quadruple, triple, and indirect triple: -(a+b)*(c+d)-
(a+b+c) .07
3. Generate the three address code for the following program segment:
While(ad)
Do if a=1 then c = c+1
Else
While a<=d
Do a= a+b. 07
4. Translate the expression –(a+b)*(c+d)*(a+b*c) into Quadruples, Triples, and Indirect triples
07
UNIT 6

5. Explain the following parameter passing methods. 1. Call-by-value 2. Call-by-reference 3.


Copy-Restore 4. Call-by-Name. 04
6. Compare: Static v/s Dynamic Memory Allocation. 04
7. Explain symbol table. For what purpose , compiler uses symbol table? 03
8. Write difference(s) between stack and heap memory allocation. 04
9. Explain activation record in detail. 07
10. Explain dynamic memory allocation strategy. 04
11. Explain Activation Record. 04
12. Explain various parameter passing methods. 04
13. Write a short note on activation record. 03
14. Explain Symbol table management in brief. 04
15. List and explain various storage allocation strategies. 07
16. Compare: Static v/s Dynamic Memory Allocation 04

UNIT 7

1. Draw a DAG for expression: a + a * (b – c) + (b – c) * d. 03


2. List the issues in code generation. 03
3. What is DAG? What are its advantages in context of optimization? How does it help in
eliminating common sub expression? 07
4. What is global optimization? Name the 2 types of analysis performed for global optimization.
03
5. What is peephole optimization? Explain with example. 07
6. Construct syntax tree and DAG for following expression: X = a * (b+c)- (b+c)* d. 04
7. Explain Activation Record. 04
8. Explain any three code-optimization technique in detail. 07
9. Explain Basic Block and Flow Graph with example. 03
10. Write three address code for a = b*-c + b*-c . 07
11. Explain various code optimization techniques. 07
12. Construct a DAG for the following expression: a = b*-c + b*-c .03
13. Explain various issues in design of code generator. 07

UNIT 8
1. Explain Basic-Block Scheduling. 04
2. Explain Pass structure of assembler. 07

_____________________________________________________________________________
1. Explain activation tree? 04
2. Define a following: i. Basic block ii. Constant folding iii. Handle. 03
3. Differentiate between parse tree and syntax tree 03
4. What do you mean by dangling references? 03

You might also like