Professional Documents
Culture Documents
COMPUTER SCIENCE
(b) Construct the NFA for the regular
( Honours ) expression a * b(a|b)* abb. Convert the
NFA to its corresponding DFA and
( Compiler Design ) minimize the DFA. 10
( CS–602 AT )
UNIT—II
Marks : 75
3. (a) Define a context-free grammar (CFG).
Time : 3 hours
Can a CFG be ambiguous? If so, explain
The figures in the margin indicate full marks with an example. 2+1+3=6
for the questions
(b) Briefly explain the difference between
Answer one question from each Unit
top-down parsing and bottom-up
parsing. What are the rules that govern
UNIT—I the calculation of the functions FIRST
and FOLLOW ? Calculate the FIRST and
1. (a) Explain the functions of lexical analyzer,
FOLLOW of the grammar given below :
syntax analyzer and intermediate code
1+4+4=9
generator of a compiler with the help of
examples. 3+3+3=9 E ® TE`
E` ® + TE` |e
(b) What type of language does a finite T ® FT`
automaton accept? Design a finite T`® *FT`|e
automaton to recognize an identifier. F ® (E)|id
2+4=6
6. (a) What do you understand by a type (c) Describe with an example how a
expression? What are the pros and cons quadruple can be used to implement
of weakly typed language over strongly three-address code. 5
typed language? 3+4=7
(b) Define the scope of a symbol in a UNIT—V
programming language. Explain the
9. (a) Discuss the factors affecting target code
different types of scopes possible in
generation. 5
block-structured languages. 2+6=8
HHH