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

Compiler design 2.O

Uploaded by

zssdzwqpd9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Compiler design 2.O

Uploaded by

zssdzwqpd9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

M.C.

A (1st Sem)
COMPILER DESIGN

SHORT QUESTIONS

✓ What do you mean by system programming? Explain the components of system


programming.

✓ What do you understand by cross compiler?

✓ What are the two types of conflicts in shift reduce parsing? Give example.

✓ Define parsing. Classify the types of parsing.

✓ What is hashing? Discuss.

✓ Differentiate between Abstract Syntax tree and DAG representation of intermediate


code.

✓ List out different object code forms.

✓ What is code optimization? Illustrate with example.

✓ What is overlay? Discuss linking of overlay structured program.

✓ What is the purpose of lexical analysis phase?

✓ Discuss Chomsky classification of grammar.

✓ Draw syntax tree for the expression:

✓ ab-c+b-c

✓ What is a symbol table? Discuss the typical entries in it.

✓ What are properties of optimizing compilers?

✓ Draw the DAG for:

✓ a=(a^ * b + c )-(a^ * b+c).

✓ What is bootstrapping?

✓ What do you understand by cross compiler?

✓ Write regular expression for specifying identifier and constant of C.

✓ Define left recursion. Is the following grammar left recursive: E->E+EE*Eab?


✓ Mention the various notational shorthand's for representing regular expressions.

✓ What is a symbol table? What are its components?

✓ What are the benefits of intermediate code generation?

✓ Explain the algorithm for basic block identification.

Unit-1
1. (a) Explain the problems faced by a one-pass assembler. Draw and explain the detailed
flowchart for pass-2 of a two-pass assembler.

(b) What are different loading schemes? Explain absolute loader scheme with its advantages
and disadvantages.

2. (a) What are the basic functions of loaders? Differentiate absolute, relative and bootstrap
loader.

(b) State the basic tasks a macro instruction processor performs. Explain how the nested
macro calls are executed with example?

3. (a) Explain the problems faced by a one-pass assembler. Draw and explain the detailed
flowchart for pass-2 of a two-pass assembler.

(b) What are different loading schemes? Explain absolute loader scheme with its advantages
and disadvantages.

4. (a) Explain use and fields of following tables of macro:

XKPDTAB, MDT, EVTAB, SSTAB.

(b) What are various loading schemes? Explain bootstrap loader with its merits and demerits.

5. (a) What are the problems faced by a one-pass assembler? Draw and explain the detailed
flowchart for pass-2 of a two-pass assembler.

(b) What is loader? Discuss different loading schemes. Explain reallocating loader scheme
with its advantages and disadvantages.

6. (a) What are the basic functions of loaders? Differentiate absolute, relative and linking
loader.

(b) Discuss the basic tasks a macro instruction processor performs. Explain how the
nested macro calls are executed with example.

Unit-2
1. (a) Differentiate between:

(i) Passes and phases of compiler

(ii) Syntax analysis and semantic analysis

(b) Construct the canonical LR(1) item sets for the following grammar:

S → AA

A → aA/b

2. (a) Compare and contrast SLR with LALR. Define Kernel items and non-kernel items.

Show the following grammar is LALR (1)

s->Aa|bAc | de | bda

A->d

(b) What are the problems with top-down parsing? Write the algorithm to remove left
recursion from a grammar with example.

3. (a) Write an algorithm to convert NFA to DFA and minimize DFA. Discuss with example.

(b) Explain the non-recursive implementation of predictive parsers with the help of grammar.

E -> E+T|T

T -> T * F|F

F -> (E) | i d
4. (a) Generate SLR parsing table for following

grammar:

S → Aa|bAc| Bc |bBa

A -> d

B -> d

And parse the sentence "bde" and "dd".

(b) How errors can be recovered in lexical phase of acompiler? Explain.


5. (a) Explain the usage of YACC parser generator in construction of a Parser.

(b) What is the role of code Optimizer in compiler? Is it a mandatory phase? Discuss.

6.(a) Consider the production:

S→aAb

A→cd/C

Show that recursive descent parsing fails for input string "acdb", also explain Recursive
Descent Algorithm.

(b) List out the functions of a Lexical Analyzer? State the reasons for the Separation of
Analysis programs into Lexical, Syntax and Semantic Analysis.

Unit-3
1. (a) Explain quadruples and triples with example.

Write three address code for the expression:

a+a* (b-c)+(b-c) * d

(b). With a neat diagram explain the format of the Symbol Table. And discuss the tree
structures representation of scope information.

2. (a) Explain various data structure used for implementing symbol table and compare them.

(b) What are different intermediate code forms? Discuss different Three Address code types
and implementations of Three Address statements.

3. (a) Explain quadruples and triples with example.

Write three address code for the expression:

a+a * (b - c) +(b-c) * d

(b) Explain various run time storage allocation strategies.

4. (a) Construct a syntax directed definition for constructing a syntax tree for assignment
statements.

S→ id : = E

E→ E1+E2

E →E1 * E2
E → E1

E →(E1)

E →id

(b) Give the general structure of activation record. Explain the purpose of each
component.

5. (a) Give the general structure of activation record. Explain the purpose of each component.

(b) What do you mean by attributed grammars? Discuss the translation scheme for converting
an infix expression to its equivalent postfix form.

6. (a) Explain the use of symbol table in compilation process. List out the various attributes
for implementing the symbol table.

(b) Generate the three-address code for the following code fragments:
while (a>b)
{If (c<d)
x=y+z;
else
x=y-z; }

Unit-4
1. (a) Explain the main issues of code generation in detail.

(b) Define peephole optimization. List the characteristics of peephole optimization.

2. (a) Explain DAG representation of basic blocks with example.

(b) Discuss the following code optimization techniques with examples:

1. Constant propagation

2. Strength reduction.

3. Code Motion

3. (a) Explain the main issues of code generation with example.

(a) Define peephole optimization. characteristics of peephole optimization. List the

4. (a) Explain DAG representation of basic blocks with example.


(b) Explain various code optimization techniques. Discuss the strategies for loop optimization
and dead code elimination.

5. (a) Explain various code optimization techniques. Discuss the strategies for loop
optimization and dead code elimination.

b) Explain why next-use information is required for generating object code? Explain the main
issues in code generation.

6. (a) Explain the different storage allocation strategies.

(b) Discuss how induction variables can be detected and eliminated from the given
intermediate code

B2: i:=i+1
t1:=4*j
t2:=a[t1]
if t2 <10goto B2

You might also like