177k views
0 votes
Convert the following grammar into Chomsky normal form:

S → ABC
A → aC | D
B → bB | ∊ |A
C → Ac | ∊ | Cc
D → aa

1 Answer

6 votes

Final answer:

To convert the given grammar into Chomsky normal form, follow the steps to eliminate ε-productions, unit productions, and productions with more than two non-terminals. Replace terminal symbols with new non-terminal symbols.

Step-by-step explanation:

To convert the given grammar into Chomsky normal form, we need to follow the following steps:

  1. Eliminate ε-productions (productions that produce the empty string) by adding new productions.
  2. Eliminate unit productions (productions where the right-hand side consists of only one non-terminal) by replacing them with their corresponding productions.
  3. Replace any production with more than two non-terminals on the right-hand side by introducing new non-terminals.
  4. Replace any terminal symbols occurring on the right-hand side of a production with a new non-terminal symbol.

Applying these steps to the given grammar, we get:

S → ABC | AB | BC

A → aC | D

B → bB | A | ε

C → Ac | Cc

D → aa

User Shaynae
by
8.0k points