JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD B.Tech III Year COMPILER DESIGN Previous Question Paper (September - 2021 - R13)

B.Tech | III Year | I Semester | R13 | September - 2021

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

Answer any five questions. All questions carry equal marks.

Main

115 marks
a

List out different phases of compiler and explain each phase role in compilation process

8 marks

Answer

A compiler translates source code into target machine code through a series of sequential phases:

  1. Lexical Analysis: Reads the source program as a stream of characters and groups them into meaningful sequences called tokens.
  2. Syntax Analysis: Takes tokens and creates a hierarchical structure, typically an Abstract Syntax Tree (AST), ensuring the code follows the language's grammar rules.
  3. Semantic Analysis: Checks for semantic consistency, such as type checking and scope resolution, ensuring the program makes sense beyond its structure.
  4. Intermediate Code Generation: Produces a machine-independent, low-level representation of the source code, such as Three-Address Code.
  5. Code Optimization: Improves the intermediate code to make the final machine code run faster or consume less memory without changing the program's behavior.
  6. Code Generation: Translates the optimized intermediate code into target-specific machine or assembly language.
  7. Symbol Table Management: A supporting phase that records identifiers and their attributes throughout the compilation process.
  8. Error Handling: Detects and reports errors encountered during any of the above phases.
b

Explain the bootstrapping.

7 marks

Answer

Bootstrapping is the process of using a compiler to compile itself or a newer version of itself. It is a technique used to port a compiler to a new environment or to develop a compiler for a new language.

The process is often represented using the T-diagram, where a compiler is defined by the source language it accepts, the target language it produces, and the language in which it is implemented. The steps typically involve:

  • Writing a small subset of the target language compiler in an existing language.
  • Compiling this subset using an existing compiler to produce a machine-executable version.
  • Using this executable to compile a more complex version of the compiler written in the target language itself.
  • Repeating this process until the full-featured compiler is produced.

This allows developers to move from a basic implementation to a fully functional, self-hosting compiler without needing to write the entire system in machine code.

215 marks
a

Write a note on complier construction tools.

7 marks

Answer

Sign in to view the complete answer paper.

b

Construct recursive descendent parsing table for following grammar.

E → E+T | T
T → TF | F
F → F* | a | b
8 marks

Answer

Sign in to view the complete answer paper.

315 marks
a

What is LALR parser? Explain LALR parsing algorithm.

8 marks

Answer

Sign in to view the complete answer paper.

b

Write a note on YACC.

7 marks

Answer

Sign in to view the complete answer paper.

415 marks
a

What is shift reduce parser? Explain conflicts in shift reduce parser.

7 marks

Answer

Sign in to view the complete answer paper.

b

Write LR parsing algorithm.

8 marks

Answer

Sign in to view the complete answer paper.

515 marks
a

Explain various different intermediate code forms.

7 marks

Answer

Sign in to view the complete answer paper.

b

Write intermediate code for assignment statement and case statement.

8 marks

Answer

Sign in to view the complete answer paper.

615 marks
a

What is syntax directed translation scheme and write syntax directed scheme for while statement.

8 marks

Answer

Sign in to view the complete answer paper.

b

Explain different formants of symbol table.

7 marks

Answer

Sign in to view the complete answer paper.

715 marks
a

Explain, how dead code elimination is done and illustrate with example.

7 marks

Answer

Sign in to view the complete answer paper.

b

Explain optimization of basic blocks.

8 marks

Answer

Sign in to view the complete answer paper.

815 marks
a

Write the issues in design of code generation.

7 marks

Answer

Sign in to view the complete answer paper.

b

Write the steps for constructing DAG for register allocation.

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 Year I Semester, September - 2021, 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...