0% found this document useful (0 votes)
5 views

compiler model QP

Uploaded by

tkspcollege
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

compiler model QP

Uploaded by

tkspcollege
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

PART A

1. What are the two parts of compilation explain briefly?

2. Illustrate diagrammatically how a language is processed.

3. Give the NFA of the operations of language.

4. Define CFG.

5. Write down the algorithm for FIRST and FOLLOW in parser.

6. Define ambiguous grammar with example.

7. What is DAG?

8. When does dangling reference occur?

9. What are the properties of optimizing compiler?

10. Write the three address code sequence for the assignment statement below.

d:=(a-b)+(a-c)+(a-c)

PART-B

11. (a) Describe various phases of compiler and trace it with a program segment

(Position: =initial +rate*60).

(0r)

(b) (i) Explain Language Processing system with neat diagram. (8)

(ii) Explain the need for grouping of phases. (4)

(iii) Explain various error encountered in different phases of compiler. (4)

12. (a) (i) Differentiate between lexeme, token and pattern.(4)

(ii) Discuss on the issues in lexical analysis. (6)

(iii) Explain briefly about compiler construction tools. (6)

(0r)

(b) (i) Explain LL(1) grammar for the sentence S iEts | iEtSeS | aEb. (8)

(ii)Consider the following Grammar

EE+T|T

TTF|F
FF*|a|b

Construct the SLR parsing table for the above grammar. (8)

13. (a)(i) Construct a syntax directed definition for constructing a syntax tree for assignment
statements. (8)

Sid:=E

EE1+E2

EE1*E2

EE1

E(E1)

Eid

(ii) Discuss on simple type checker. (8)

(Or)

(b).Explain about constructing Syntax tree for an expression with example. Write Syntax
directed definition for constructing syntax trees. Draw an annotated parse tree for the
expression a-4+c.

14. (a) (i) Explain optimization of basic blocks.(8)

(ii) Construct DAG for the following Basic block.

1. t1:= 4*i

2. t2=a[t1]

3. t3:=4*i

4. t4:=b[t3]

5. t5:=t2*t4

6. t6:= prod+t5

7. prod:=t6

8. t7:=i+1

9. i:=t7

10. if I < = 20 goto (1).

(b) Discuss on designing simple code generator in detail.

15(a). Explain briefly about the principal sources of optimization.


(or)

(b) Explain in detail about Global Data flow Analysis.

PART C

16. (a) Construct the predictive parsing table and describe the moves of the parser on
the input string. Design a predictive parser for the following grammar.

EE+T|T

T T*F|F

F (E) |id. Show the moves of the parser on the input id+id*id.

(or)

16. b. Write and algorithm to convert NFA to DFA and Minimizing DFA. Give an example
for minimization.

You might also like