JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD B.Tech III FINITE AUTOMATA AND COMPILER DESIGN Previous Question Paper (January/February - 2023 - R18)

B.Tech | III | III-I | R18 | January/February - 2023

Answer PaperPaper Code: 155FGMaximum Marks: 75Time: 3 Hours

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

1.a

Define a Context Free Grammar.

2 marks

Answer

A Context Free Grammar (CFG) is a formal grammar defined by a 4-tuple G = (V, Σ, R, S), where V is a finite set of variables (non-terminals), Σ is a finite set of terminals disjoint from V, R is a finite set of production rules of the form A → α (where A is a variable and α is a string of variables and terminals), and S is the start symbol from V. It is used to generate the strings of a context-free language by recursively applying production rules.

1.b

Define Token, Pattern and Lexeme.

3 marks

Answer

A token is a category or classification of lexical units, such as an identifier, keyword, or operator, which is represented as a pair consisting of a token name and an optional attribute value. A pattern is the set of rules or the regular expression that describes the form that the lexemes of a particular token may take. A lexeme is the actual sequence of characters in the source program that matches the pattern for a token.

1.c

Define ‘Handle’ in shift reduce parser.

2 marks

Answer

Sign in to view the complete answer paper.

1.d

List out the rules for computing FIRST SET.

3 marks

Answer

Sign in to view the complete answer paper.

1.e

What is the difference between type conversion and type checking?

2 marks

Answer

Sign in to view the complete answer paper.

1.f

Define Regular Grammar.

3 marks

Answer

Sign in to view the complete answer paper.

1.g

How to define the Leader in a Basic Block?

2 marks

Answer

Sign in to view the complete answer paper.

1.h

What is dynamic storage allocation?

3 marks

Answer

Sign in to view the complete answer paper.

1.i

What do you mean by machine dependent code generation?

2 marks

Answer

Sign in to view the complete answer paper.

1.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

10 marks
a

Remove left recursion from the above CFG.

3 marks

Answer

Sign in to view the complete answer paper.

b

Compute FIRST and FOLLOW set for the non-terminals of the resulting grammar.

4 marks

Answer

Sign in to view the complete answer paper.

c

Show that the resulting grammar is LL(1).

3 marks

Answer

Sign in to view the complete answer paper.

OR
3

Design FA for the following Regular Expression over Σ{0, 1}

a) 01(1+0)*10

b) 11(0+1)*101(0+1)*{0 1}

10 marks

Answer

Sign in to view the complete answer paper.

4

What is LR parser? Compare and contrast the different types of LR parsers.

10 marks

Answer

Sign in to view the complete answer paper.

OR
510 marks
a

How are ambiguities resolved in YACC?

5 marks

Answer

Sign in to view the complete answer paper.

b

What are L-attributed definitions? Explain with an example.

5 marks

Answer

Sign in to view the complete answer paper.

6

Explain in detail about Chomsky hierarchy of grammars.

10 marks

Answer

Sign in to view the complete answer paper.

OR
7

Distinguish static and dynamic Type checking.

10 marks

Answer

Sign in to view the complete answer paper.

8

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

10 marks

Answer

Sign in to view the complete answer paper.

OR
9

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

10 marks

Answer

Sign in to view the complete answer paper.

10

Explain about Generic code generation algorithm.

10 marks

Answer

Sign in to view the complete answer paper.

OR
1110 marks
a

Define a Directed Acyclic Graph. Construct a DAG and write the sequence of instructions for the expression 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 following fragment using the above attribute grammar: for i= 1 to n step m+k do s:= s+i.

5 marks

Answer

Sign in to view the complete answer paper.

About this paper

This page contains the solved question paper with answers of FINITE AUTOMATA AND COMPILER DESIGN from JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD for B.Tech CSE(NETWORKS) III III-I, January/February - 2023, R18.

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

Other papers in FINITE AUTOMATA AND COMPILER DESIGN

Loading Question Papers

Fetching data from database...