JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD B.Tech III COMPILER DESIGN Previous Question Paper (July - 2023 - R16)
Note: i) Question paper consists of Part A, Part B. ii) Part A is compulsory, which carries 25 marks. In Part A, Answer all questions. iii) In Part B, Answer any one question from each unit. Each question carries 10 marks and may have a, b as sub questions.
PART - A
Define finite automata.
Answer
A finite automaton is a mathematical model of computation consisting of a finite set of states and a set of transitions from state to state that occur on input symbols. It is defined by a 5-tuple (Q, Σ, δ, q₀, F), where Q is a finite set of states, Σ is a finite set of input symbols (alphabet), δ is the transition function mapping (Q × Σ) to Q, q₀ is the start state, and F is the set of final or accepting states.
Differentiate pass and phase.
Answer
In compiler design, a phase represents a logically distinct stage of the compilation process that performs a specific task, such as lexical analysis, syntax analysis, or code generation. A pass refers to a single traversal of the entire source program or its intermediate representation by the compiler to perform one or more phases.
Key differences include:
- Multiple phases can be combined into a single pass to improve efficiency by reducing the number of times the compiler reads and writes to memory or disk.
- A phase is defined by its functional role in the translation process, whereas a pass is defined by the physical traversal of the code structure.
- Compilers are often designed to minimize the number of passes to reduce compilation time, even if the process involves several distinct logical phases.
If I is set of items of LR parser, then define CLOSURE(I).
Answer
Sign in to view the complete answer paper.
Differentiate top-down parsing and bottom-up parsing.
Answer
Sign in to view the complete answer paper.
Give different variants of syntax tree.
Answer
Sign in to view the complete answer paper.
What is the purpose of intermediate code in the context of compiler design?
Answer
Sign in to view the complete answer paper.
Define a flow graph. Give an example for it.
Answer
Sign in to view the complete answer paper.
Define basic block.
Answer
Sign in to view the complete answer paper.
What is the meaning of reduction in strength optimization?
Answer
Sign in to view the complete answer paper.
What do you mean by machine independent optimization? How it is different from machine dependent optimization?
Answer
Sign in to view the complete answer paper.
PART - B
Obtain Finite Automata for the regular expression 0*(11)* 0.
Answer
Sign in to view the complete answer paper.
Explain the functions of lexical analyzer.
Answer
Sign in to view the complete answer paper.
Design finite automata for the regular expression (a+b)*aab*.
Answer
Sign in to view the complete answer paper.
Explain the concept of boot strapping to generate new compiler from existing compilers.
Answer
Sign in to view the complete answer paper.
Construct SLR parsing table for the following context free grammar: E → E + T | T, T → T * F | F, F → id. Where V = { E, T, F }, T = { +, *, id } and E is start variable.
Answer
Sign in to view the complete answer paper.
Construct LL parsing table for the following context free grammar. S → CC, C → aC | b | a. Where V = {S,C}, T = {a,b} and S is start variable.
Answer
Sign in to view the complete answer paper.
Write intermediate code for the expression a=b*-d + c*-d.
Answer
Sign in to view the complete answer paper.
What is type checking? Give the rules for type checking of control flow and switch statements.
Answer
Sign in to view the complete answer paper.
Explain different Syntax-Directed Translation Schemes.
Answer
Sign in to view the complete answer paper.
What are different forms of intermediate code?
Answer
Sign in to view the complete answer paper.
Explain Peephole optimization.
Answer
Sign in to view the complete answer paper.
Describe the issues in the design of code generator.
Answer
Sign in to view the complete answer paper.
Explain stack allocation method for runtime memory.
Answer
Sign in to view the complete answer paper.
Explain how to optimize basic block.
Answer
Sign in to view the complete answer paper.
Explain the following optimization techniques: i) Redundant sub expression elimination ii) Copy propagation
Answer
Sign in to view the complete answer paper.
How flow graph is useful in optimization?
Answer
Sign in to view the complete answer paper.
Explain the following optimization techniques. i) Loop optimization ii) Dead-code elimination.
Answer
Sign in to view the complete answer paper.
Explain data flow analysis procedure with suitable example.
Answer
Sign in to view the complete answer paper.