You are on page 1of 4

AMITY SCHOOL OF ENGINEERING & TECHNOLOGY, NOIDA

COMPILER CONSTRUCTION, B.TECH, CSE, VII SEM

ASSIGNMENT-2

QUESTION 1

QUESTION-2

QUESTION-3
QUESTION-4

QUESTION-5

What is Shift-Reduce and Reduce-Reduce conflict? How these can be resolved? With
examples explain in which condition S-R and R-R conflict can occur in SLR, canonical
LR and LALR parsers. (Make use of LR (0), LR (1) items).

QUESTION-6

For given code generate output for every phase of compiler .

{
Int i = 1;
Int a[10];
While (i <= 10)
{
a[i] = 0;
i = i + 1;
}
}

QUESTION-7

Create a cross compiler SCLA Using previously known languages ACSA .

QUESTION-8

Construct LR(1) parsing table for following grammar

S -> aBD / AB / DAC / b


A -> SCB / SABC / CbD / C / €
B -> d / €
C -> ADC / c
D -> SaC / SC / fg

QUESTION-9

Construct LR (0) parsing table for each of the following grammars:

(a)

S -> cA / ccB
A -> cA / a
B -> ccB / b

(b)

S -> aSSb / aSSS / c

Question-10

Construct LALR Parsing Table for following grammar:

S -> B
B -> begin DA end
D -> Dd; / €
A -> A; E / €
E -> B / S

Question-11

Write short notes on:

(a) Inherited Translation.


(b) Synthesized Translation.
(c) Procedure call with example.
(d) Call by value & call by reference with example.
(e) Lexical phase errors
(f) syntax phase errors

You might also like