JNTU

JNTU B.Tech III AUTOMATA AND COMPILER DESIGN Previous Question Paper (November/December - 2017 - R15)

B.Tech | III | III-I | R15 | November/December - 2017

Answer PaperPaper Code: 125DRMaximum Marks: 75Time: 3 hours

Note: This question paper contains two parts A and B. Part A is compulsory which carries 25 marks. Answer all questions in Part A. Part B consists of 5 Units. Answer any one full question from each unit. Each question carries 10 marks and may have a, b, c as sub questions.

PART - A

125 marks
a

Define a context free grammar? Design a CFG that generates floating-point literal.

2 marks

Answer

A Context-Free Grammar (CFG) is a 4-tuple G = (V, T, P, S) where V is a set of variables, T is a set of terminals, P is a set of productions of the form A → α (where A ∈ V and α ∈ (V ∪ T)*), and S is the start symbol. A CFG for a floating-point literal (e.g., 12.34) is:

Digit → 0 | 1 | ... | 9
Number → Digit Number | Digit
Float → Number . Number

b

Considering the following grammar, remove left recursion and left factor the grammar to be LL (1).

L → L ; S | S
S → id = E | id (E)
E → id | num
3 marks

Answer

To remove left recursion from L → L ; S | S, we introduce a new variable L':

L → S L'
L' → ; S L' | ε
S → id = E | id (E)
E → id | num
Left factoring S:
S → id S'
S' → = E | (E)
L → S L'
L' → ; S L' | ε
E → id | num

c

What is syntax directed definition? Give a suitable example?

2 marks

Answer

Sign in to view the complete answer paper.

d

Find the canonical collection of sets of LR(1) items

S → AaAb
A → BbBa
A → ε
B → ε
3 marks

Answer

Sign in to view the complete answer paper.

e

What is the difference between type conversion and type checking? Explain with the help of a high level language?

2 marks

Answer

Sign in to view the complete answer paper.

f

What is unit production in CFG? What is the procedure to eliminate Unit productions?

3 marks

Answer

Sign in to view the complete answer paper.

g

Explain the principle sources of optimization. What are the patterns used for code optimization? What are the 3 areas of code optimization?

2 marks

Answer

Sign in to view the complete answer paper.

h

What are the rules to determine the leaders of basic blocks? What is the use of algebraic transformation?

3 marks

Answer

Sign in to view the complete answer paper.

i

What is a flow graph? Mention the applications of DAGs.

2 marks

Answer

Sign in to view the complete answer paper.

j

Construct a DAG for the expression a = b * -c + b * -c.

3 marks

Answer

Sign in to view the complete answer paper.

PART - B

2

Consider the following grammar: lexp → atom | list; atom → number | identifier; list → ( lexp_seq ); lexp_seq → lexp_seq lexp | lexp. Answer the following: Remove left recursion, Construct FIRST and FOLLOW set, Construct LL(1) parsing table, Show that it is LL(1), Show parsing action for input (a (b (2)) (c)).

10 marks

Answer

Sign in to view the complete answer paper.

OR
310 marks
a

Construct an LL(1) parsing Table for the given grammar.

5 marks

Answer

Sign in to view the complete answer paper.

b

Construct DFA equivalent to the NFA ({p, q, r, s}, {0,1}, δ, p, {s}) where the transition function δ is given in following table.

5 marks

Answer

Sign in to view the complete answer paper.

410 marks
a

Discuss the construction of LR parser. What are the various data structures used? Discuss construction of ACTION and GOTO table.

5 marks

Answer

Sign in to view the complete answer paper.

b

Write syntax directed definition to implement a desk calculator with an LR parser and show the evaluation of expression ‘95*4 + 5’.

5 marks

Answer

Sign in to view the complete answer paper.

OR
510 marks
a

Describe the syntax directed translation procedure for assignment statements with integers and mixed types.

5 marks

Answer

Sign in to view the complete answer paper.

b

Construct LALR(1) parsers for the following grammar: S → L = R | R; L → * R | id; R → L.

5 marks

Answer

Sign in to view the complete answer paper.

610 marks
a

What is phase structure grammar? State and explain Chomsky classification of grammar with examples.

5 marks

Answer

Sign in to view the complete answer paper.

b

For the given grammar, eliminate useless symbols, ε-production, unit production, and convert to CNF.

5 marks

Answer

Sign in to view the complete answer paper.

OR
710 marks
a

What is phase structure grammar? What is Chomsky normal form of grammar? Explains the steps used to reduce a CFG to CNF.

5 marks

Answer

Sign in to view the complete answer paper.

b

Convert the following grammar into Chomsky normal form: S → AAA | B; A → aA | B; B → ε.

5 marks

Answer

Sign in to view the complete answer paper.

810 marks
a

Give the block diagram of organization of code optimizer. What are the advantages?

5 marks

Answer

Sign in to view the complete answer paper.

b

What is dynamic storage allocation? Why is not static allocation sufficient for everything?

5 marks

Answer

Sign in to view the complete answer paper.

OR
910 marks
a

What is activation record? Discuss the structure and layout of a typical activation record.

5 marks

Answer

Sign in to view the complete answer paper.

b

Explain machine dependent and independent code optimization. How to represent the dummy blocks with no statements indicated in global dataflow analysis?

5 marks

Answer

Sign in to view the complete answer paper.

1010 marks
a

Define a DAG. Construct a DAG and write sequence of instructions for: a + a * ( b – c ) + ( b – c ) * d.

5 marks

Answer

Sign in to view the complete answer paper.

b

Give the sequence of three-address code instructions corresponding to the fragment: for i= 1 to n step m+k do s:= s+i.

5 marks

Answer

Sign in to view the complete answer paper.

OR
1110 marks
a

Explain code generation process and steps for expression: (A + B) / C + D. Assume two machine registers are available.

5 marks

Answer

Sign in to view the complete answer paper.

b

Explain the various issues in the design of code generation. Construct the DAG for the basic block: d:= b*c; e:= a+b; b:= b*c; a:= e-d.

5 marks

Answer

Sign in to view the complete answer paper.

About this paper

This page contains the solved question paper with answers of AUTOMATA AND COMPILER DESIGN from JNTU for B.Tech IT III III-I, November/December - 2017, R15.

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

Other papers in AUTOMATA AND COMPILER DESIGN

Loading Question Papers

Fetching data from database...