Principles of Compiler Design 2001 Regulations CS337
Principles of Compiler Design 2001 Regulations CS337
Reg. No. :
1. Define Compiler.
12. a) i) Construct a minimum state DFA for the regular expression (a b) * abc. (10)
ii) Explain the role of lexical analyzer. (6)
(OR)
b) i) Explain in detail about the error recovery strategies in parsing. (8)
ii) Consider the grammar
E → E + E/E * E/(E)/id. (8)
Show the sequence of moves made by the shift-reduce parser on the input
id1 + id2 * id3 and determine whether the given string is accepted by the
parser or not.
13. a) i) What is a shift-reduce parser ? Explain in detail the conflicts that may
occur during shift-reduce parsing. (6)
ii) For the grammar given below, calculate the operator precedence relation
and the precedence functions. (10)
E → E + E|E – E|E * E|E/E| E ↑ E |(E)|– E|id
(OR)
b) i) Consider the grammar given below : (12)
E → E + T
E → T
T→T*F
T→F
F → (E)
F → id
Construct an LR Parsing table for the above grammar. Give the moves of
LR parser on id * id + id.
ii) Briefly explain error recovery in LR Parsing. (4)
14. a) Brief Intermediate code generation for Basic block, Control flow and Boolean
expressions. (16)
(OR)
b) i) Explain the data structure used for implementing symbol table. (10)
ii) Write about Quadruple and Triple with its structure. (6)