0% found this document useful (0 votes)
160 views2 pages

Principles of Compiler Design 2001 Regulations CS337

This document is a question paper for a Computer Science and Engineering exam covering the topic of Compiler Design. It contains 15 multiple choice questions across two sections. The questions cover topics such as the phases of a compiler, regular expressions, ambiguity in grammars, parsing strategies like shift-reduce parsing, LR parsing, symbol tables, code generation and memory management. Students have to choose between two questions for each of the five questions in Part B.

Uploaded by

Monica Naresh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
160 views2 pages

Principles of Compiler Design 2001 Regulations CS337

This document is a question paper for a Computer Science and Engineering exam covering the topic of Compiler Design. It contains 15 multiple choice questions across two sections. The questions cover topics such as the phases of a compiler, regular expressions, ambiguity in grammars, parsing strategies like shift-reduce parsing, LR parsing, symbol tables, code generation and memory management. Students have to choose between two questions for each of the five questions in Part B.

Uploaded by

Monica Naresh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

*X64263*

Reg. No. :

Question Paper Code : X 64263


B.e./B.Tech. Degree Examinations, NOVEMBER/DECEMBER 2020
Sixth Semester
Computer Science and Engineering
CS 337 – Principles of Compiler Design
(Regulations 2001)

Time : Three Hours Maximum : 100 Marks

Answer all questions

Part – A (10×2=20 Marks)

1. Define Compiler.

2. What is Regular Expression ?

3. Draw an NFA for (a*|b*).

4. What is an ambiguous grammar ? Give an example.

5. What are the goals of error handler in a parser ?

6. State the parts of a Yacc source program.

7. Give the ways of representing three address statements.

8. What is back patching ?

9. What are basic blocks ?

10. What are the properties of optimizing compilers ?

Part – B (5×16=80 Marks)

11. a) i) Explain the various phases of compiler in detail. (10)


ii) Explain the rules of regular expression with an example. (6)
(OR)
b) i) Give a detailed note on the compiler-construction tools. (10)
ii) Explain briefly about input buffering in reading the source program for
finding the tokens. (6)
X 64263 *X64263*

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)

15. a) i) Discuss about the code generation algorithm in detail. (10)


ii) Suggest a suitable representation for symbol tables of procedure oriented
languages. (6)
(OR)
b) i) Explain the various issues in the design of code generator. (10)
ii) Describe in detail about the stack allocation in memory management. (6)
–––––––––––––

You might also like