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

Assignment 3

Uploaded by

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

Assignment 3

Uploaded by

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

G. L.

Bajaj Institute of Technology and Management, Greater Noida


Department of Applied Computational Science & Engineering
Theory of Automata and Formal Language
Session: 2023-24 (Even Sem)
(TAFL)- BCS-402
ASSIGNMENT-03 (Unit-3)

Faculty Name: Mani Shivhare Last Date of Submission: 10/06/2024


Section: CSDS-3&CSDS-4 Sem: 4th
S. No. Questions COs BL
1. Define Context Free Grammar (CFG). BCS 402.3 K2
2. Check whether the grammar is ambiguous or not. BCS 402.3 K3
R → R+R/ RR/ R*/ a / b / c.
Obtain the string w = a+b*c
3. Convert the FA given below to left linear grammar. BCS 402.3 K3

4. A. Convert the following CFG into CNF BCS 402.3 K3

S → XY | Xn | p

X → mX | m

Y → Xn | o

B. Convert the following CFG into CNF

S → ASA | aB, A → B | S, B → b | ε

C. Convert the following CFG to its equivalent GNF:

S → AA | a, A → SS | b.

5. (a) Discuss inherent ambiguity of context free languages with BCS 402.3 K3
suitable example.
Construct the context free grammar that accepts language
L={aibjck| i = j or j =k; i, j, k are positive integers}.
(b) Define parse tree. Find parse tree for the string abbcde
considering the productions-
S → aAcBe
A → Ab
A→b
B→d
Is this ambiguous? Justify.
(c) Prove that the following grammar of arithmetic a
expressions is ambiguous
E → E+E / E* E / (E) / id
6. (a) Design the CFG for the following language: BCS 402.3 K3
● L = {0m1n | m ≠ n & m,n ≥ 1}
● L = {albmcn | l + m = n & l,m ≥ 1}
● L = {a2nbn |n>=3}.
(b) Prove that the following Language L = {anbncn} is not
Context Free.
7. a. Describe the language generated by the following grammar : BCS 402.3 K3
S → bS/aA/ε
A → aA/bB/b
B → bS
b. Show that the given grammar is ambiguous. Also find an
equivalent unambiguous grammar.
S → ABA
A → aA/ε
B → bB/ε
8. a. Define Chomsky hierarchy. BCS 402.3 K2
b. Is context free language closed under union? If yes, give an
example.
9. a. Remove useless productions from the given productions: BCS 402.3 K3
S → AB|ab,
A → aA|B|a,
B → D|E
b. Find a CFG with no useless symbols equivalent to the
following grammar:
S → AB / CA
A→a
B → BC / AB
C→ AB / b
c. Reduce the given grammar G=({S,A,B},{a,b},P,S) to
Chomsky Normal Form. Where P is defined as:
S→ bA | aB
A→ bAA | aS | a
B → aBB | bS | b
10. (a) Consider the CFG with the following production rules: BCS 402.3 K3
S → aB / bA
A → bAA / aS / a
B → aBB / bS / b
(a) Give a right most derivation and draw the derivation tree for
the string “bbaab”.
(b) Convert the grammar into chomsky normal form (CNF).

You might also like