Answer:
To convert the given context-free grammar (CFG) into Chomsky Normal Form (CNF), we need to follow the following steps:
Step 1: Eliminate the start symbol from the right-hand side of the productions.
We can eliminate the start symbol S from the right-hand side of the first production by introducing a new non-terminal symbol S' and a new production S'⟶S.
So, the new productions are:
S'⟶S
S⟶aABDλ
A⟶BC∣a
B⟶Bb∣b∣λ
C⟶CD∣λ
D⟶d
Step 2: Eliminate λ-productions.
The non-terminal symbol B generates λ, so we need to add new productions to eliminate λ-productions.
The new productions are:
B⟶Bb∣b∣bB'
B'⟶B∣λ
So, the new set of productions are:
S'⟶S
S⟶aABDλ
A⟶BC∣a
B⟶Bb∣b∣bB'
B'⟶B∣λ
C⟶CD∣λ
D⟶d
Step 3: Eliminate unit productions.
The non-terminal symbol A generates B and C, so we can replace A with B and C in the production S⟶aABDλ.
The new productions are:
S'⟶S
S⟶aBCDλ∣aBDλ∣aBD∣aCD∣aC∣aD∣aB∣a
A⟶BC∣a
B⟶Bb∣b∣bB'
B'⟶B∣λ
C⟶CD∣λ
D⟶d
Step 4: Convert productions to CNF.
The new productions are:
S'⟶S
S⟶aBCDλ∣aBDλ∣aBD∣aCD∣aC∣aD∣aB∣a
A⟶BC∣a
B⟶BB1∣b∣bB'
B'⟶B∣λ
C⟶CC1∣λ
D⟶d
B1⟶b
C1⟶CD
The resulting CFG is in Chomsky Normal Form (