Jawaharlal Nehru Technological University Hyderabad

Jawaharlal Nehru Technological University Hyderabad B.Tech III COMPILER DESIGN Previous Question Paper (August - 2022 - R13)

B.Tech | III | I | R13 | August - 2022

Answer PaperPaper Code: 115APMaximum Marks: 75Time: 3 Hours

Answer any five questions

All questions carry equal marks

Main

115 marks
a

What is LEX? Explain in brief about the different sections of LEX Program.

10 marks

Answer

Lex is a tool used for generating lexical analyzers (scanners). It takes a set of regular expressions as input and produces a C program that recognizes the tokens defined by those expressions. A Lex program is structured into three distinct sections separated by the delimiter %%:

  • Definitions Section: This section includes declarations of variables, manifest constants, and regular expression definitions (abbreviations) that are used in the rules section.
  • Rules Section: This is the core of the program, containing a list of patterns (regular expressions) and the corresponding actions (C code) to be executed when a pattern is matched.
  • User Subroutines Section: This section contains auxiliary C functions or code that are copied directly into the generated lexer, allowing for custom logic or helper functions.
b

Differentiate between a compiler and an interpreter.

5 marks

Answer

FeatureCompilerInterpreter
ExecutionTranslates entire source code into machine code before execution.Translates and executes source code line-by-line.
PerformanceFaster execution speed as the code is pre-compiled.Slower execution speed due to interpretation overhead.
MemoryRequires more memory to store the generated object code.Requires less memory as it does not store intermediate object code.
Error HandlingReports all syntax errors after scanning the entire code.Stops execution at the first error encountered.
215 marks
a

Define a Compiler. Explain in brief about the types of lexical errors with example.

7 marks

Answer

Sign in to view the complete answer paper.

b

Explain in brief about compiler construction tools.

8 marks

Answer

Sign in to view the complete answer paper.

3

Construct CLR Parsing table for the grammar:

S → L = R | R
L → * R | id
R → L
15 marks

Answer

Sign in to view the complete answer paper.

4

Demonstrate various conflicts raised in shift-reduce parsers with an example.

15 marks

Answer

Sign in to view the complete answer paper.

515 marks
a

Construct an annotated parse tree for 3*4+5.

4 marks

Answer

Sign in to view the complete answer paper.

b

Translate the expression –(a+b)*(c+d)+(a+b+c) in to quadruple, triple and indirect triple.

6 marks

Answer

Sign in to view the complete answer paper.

c

What are attributed grammars? Give an example.

5 marks

Answer

Sign in to view the complete answer paper.

6

Define Symbol table. Explain about the data structures used for Symbol table.

15 marks

Answer

Sign in to view the complete answer paper.

7

Define code generator. Discuss about Instruction Selection and Register allocation.

15 marks

Answer

Sign in to view the complete answer paper.

815 marks
a

Explain in brief about different Principal sources of optimization techniques with suitable examples.

7 marks

Answer

Sign in to view the complete answer paper.

b

What is a Flow Graph? Explain how a given program can be converted in to a Flow graph.

8 marks

Answer

Sign in to view the complete answer paper.

About this paper

This page contains the solved question paper with answers of COMPILER DESIGN from Jawaharlal Nehru Technological University Hyderabad for B.Tech CSE III I, August - 2022, R13.

For the question paper without answers, switch to the Question Paper tab.

Other papers in COMPILER DESIGN

Loading Question Papers

Fetching data from database...