7.6k views
2 votes
Models of Languages and Computations

The four parts of this problem deal with the transformations associated with the Chomsky normal form.
1. Let G be the CFG shown below.
S → ASB | ϵ
A → aAS | a
B → SbS | A | bb
Convert G to an equivalent grammar G1 (accepts the same language) which does not contain any
ϵ-productions.

User Pavan T
by
7.8k points

1 Answer

5 votes

Final answer:

To convert the given CFG to an equivalent grammar G1 without epsilon productions, we need to remove all epsilon productions and unit productions. The resulting equivalent grammar G1 is S → ASB | AS | SB | AB | A | B, A → aAS | a, B → SbS | A | bb.

Step-by-step explanation:

In order to convert the given context-free grammar (CFG) to an equivalent grammar G1 that does not contain any epsilon productions, we need to eliminate the epsilon production rules. An epsilon production is a rule where the right-hand side of the production is an empty string.

Starting with the given CFG:

S → ASB | ϵ
A → aAS | a
B → SbS | A | bb

To eliminate the epsilon production, we use the following steps:

  1. Remove all epsilon productions by replacing any non-terminal symbol in the right-hand side with its corresponding productions except for the epsilon production itself.
  2. Remove any resulting unit productions by replacing the non-terminal symbol on the right-hand side with its corresponding productions.
  3. Repeat steps 1 and 2 until no more epsilon and unit productions remain.

After applying these steps, the equivalent grammar G1 without any epsilon productions is:

S → ASB | AS | SB | AB | A | B
A → aAS | a
B → SbS | A | bb

User Erick Castrillo
by
8.6k points