JNTU
JNTU B.Tech III COMPILER DESIGN Previous Question Paper (July/August - 2023 - R13)
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
25 Marks
Define the term Tokens in lexical analysis phase.
Answer
A token is a sequence of characters in the source program that can be treated as a single logical unit. Examples include keywords, identifiers, operators, constants, and punctuation marks.
Write a short note on Context Free Grammar.
Answer
A Context-Free Grammar (CFG) is a formal grammar used to define the syntax of programming languages. It consists of a set of recursive rules (productions) used to generate patterns of strings. A CFG is defined by a 4-tuple (V, Σ, R, S), where V is a set of non-terminals, Σ is a set of terminals, R is a set of production rules of the form A → α, and S is the start symbol.
List different rules to compute FIRSTSET.
Answer
Sign in to view the complete answer paper.
Brief different types of LR parsers.
Answer
Sign in to view the complete answer paper.
List different data structures used for symbol table.
Answer
Sign in to view the complete answer paper.
Define syntax tree? Draw the syntax tree for the assignment statement a := b * -c + b * -c.
Answer
Sign in to view the complete answer paper.
Define DAG.
Answer
Sign in to view the complete answer paper.
Write a short note on global optimization.
Answer
Sign in to view the complete answer paper.
Write in detail the issues in the design of code generator.
Answer
Sign in to view the complete answer paper.
List the properties of code generation.
Answer
Sign in to view the complete answer paper.
Part B
50 Marks
Differentiate between the Pass and Phase in compiler construction.
Answer
Sign in to view the complete answer paper.
Explain the general format of a LEX program with example.
Answer
Sign in to view the complete answer paper.
Prepare the predictive parser for the following grammar: S→a|b|(T), T →T, S|S. Write down the necessary algorithms and define FIRST and FOLLOW. Show the behavior of the parser in the sentences: a) (a,(a,a)) b) ((a,a),a,(a),a).
Answer
Sign in to view the complete answer paper.
State shift-reduce parsing? Explain in detail the conflicts that may occur during shift-reduce parsing. Illustrate with an example.
Answer
Sign in to view the complete answer paper.
Construct SLR parsing table for the following grammar: E→E+T|T, T→T*F|F, F→(E)|id.
Answer
Sign in to view the complete answer paper.
Explain Intermediate code generation for Basic block.
Answer
Sign in to view the complete answer paper.
Write the advantages and disadvantages of heap storage allocation strategies.
Answer
Sign in to view the complete answer paper.
Explain three address codes and mention its types. Generate the three-address code for the following C program fragment: while(a > b) { if (c < d) x = y + z; else x = y - z; }
Answer
Sign in to view the complete answer paper.
Explain the principle sources of code optimization in detail.
Answer
Sign in to view the complete answer paper.
Write a brief note on Data Flow Analysis of structural programs.
Answer
Sign in to view the complete answer paper.
Construct the DAG for the following basic block: D:=B*C, E:=A+B, B:=B+C, A:=E-D
Answer
Sign in to view the complete answer paper.
Explain in detail about Copy Propagation.
Answer
Sign in to view the complete answer paper.
Discuss various object code forms.
Answer
Sign in to view the complete answer paper.
Write a short note on DAG for register allocation.
Answer
Sign in to view the complete answer paper.
Explain Machine dependent code optimization in detail with an example.
Answer
Sign in to view the complete answer paper.