Compiler-Design
Compiler-Design
India’s Best Online Coaching Platform for GATE, ESE, PSUs, SSC‐JE, SSC, Banks, Groups & PSC Exams
Enjoy a smooth online learning experience in various languages at your convenience
2 CSIT-Postal Coaching Solutions
a S b
b S a
a S b
b
Regular Live Doubt clearing Sessions | Free Online Test Series | ASK an expert
Affordable Fee | Available 1M |3M |6M |12M |18M and 24 Months Subscription Packages
3 Compiler Design
India’s Best Online Coaching Platform for GATE, ESE, PSUs, SSC‐JE, SSC, Banks, Groups & PSC Exams
Enjoy a smooth online learning experience in various languages at your convenience
4 CSIT-Postal Coaching Solutions
E
21. Ans: (c)
Sol: Follow(T) = {+, $} E + T
First(S) = {a, +, } T T* F
Follow(T) First (S) = {+}
F F id
Sol: S→aSbs and S→ both appear in ‘S’ row Sol: Trail(E) = {+} Trail(T)
and ‘a’ column. = {+, *} Trail(F)
= {+, *, ), id}
31. Ans: 0
Sol: The grammar is LL(1) Since the parse table 39. Ans: (b)
is free from multiple entries Sol: Lead (E) >+ and lead (E) contains {+, ↑, id}
A→S is entered into M[S, follow(A)] Sol: The grammar E E + E/a can have an
= A→S operator precedence parser but not an LR
parser.
33. Ans: (a) & (d)
Sol: An operator grammar is -free grammar and 42. Ans: (a)
no two non terminals are adjacent. Sol: The grammar
E → E + T | T, T → i
34. Ans: (c)
is left recursive. So it is not LL(1) but is
Sol: An operator grammar is ‘’ free grammar
LR(0). So (a) is true & (b) is false.
and no two non-terminals are adjacent.
The grammar
S → a | aA
35. Ans: (b)
Sol: The precedence relation between two A→b
adjacent terminals is =. has the LR(0) machine
Regular Live Doubt clearing Sessions | Free Online Test Series | ASK an expert
Affordable Fee | Available 1M |3M |6M |12M |18M and 24 Months Subscription Packages
7 Compiler Design
India’s Best Online Coaching Platform for GATE, ESE, PSUs, SSC‐JE, SSC, Banks, Groups & PSC Exams
Enjoy a smooth online learning experience in various languages at your convenience
8 CSIT-Postal Coaching Solutions
A Ab., $/b
Item 3 has Shift-Reduce conflict. 65. Ans: (b)
Regular Live Doubt clearing Sessions | Free Online Test Series | ASK an expert
Affordable Fee | Available 1M |3M |6M |12M |18M and 24 Months Subscription Packages
9 Compiler Design
India’s Best Online Coaching Platform for GATE, ESE, PSUs, SSC‐JE, SSC, Banks, Groups & PSC Exams
Enjoy a smooth online learning experience in various languages at your convenience
10 CSIT-Postal Coaching Solutions
G Neg(AND(A, OR(NOT(A),B)))
E = – + abc
F Neg(AND(A, OR(NOT(A),B)))
c
( F ) AND(A, OR(NOT(A),B))
E=a + T=b
A= F OR(NOT(A),B)
T=a b
F
a ( F ) OR(NOT(A),B)
Regular Live Doubt clearing Sessions | Free Online Test Series | ASK an expert
Affordable Fee | Available 1M |3M |6M |12M |18M and 24 Months Subscription Packages
11 Compiler Design
S E print (↑)
a ↑ E
c Print 5
A + A (1) A + A (1)
Regular Live Doubt clearing Sessions | Free Online Test Series | ASK an expert
Affordable Fee | Available 1M |3M |6M |12M |18M and 24 Months Subscription Packages
13 Compiler Design
end
Regular Live Doubt clearing Sessions | Free Online Test Series | ASK an expert
Affordable Fee | Available 1M |3M |6M |12M |18M and 24 Months Subscription Packages