josè
josè

Reputation: 1

Chomsky Normal Form correctness

I have these productions:

S->aSb
S-> eps      (eps=empty string)

I should apply the Chomsky Normal Form

My reasoning:

1) eliminate the eps rules Given:

S->aSb
S-> eps

I get:

S->ab

S->aSb

2) eliminate the unit rules

There are none

3) remove useless symbols

I get:

S->ab

So, the given grammar after applying CNF (Chomsky Normal Form) becomes:

S->ab

Am I right?

Upvotes: 0

Views: 1010

Answers (1)

templatetypedef
templatetypedef

Reputation: 372992

What you have here is not quite the same. Notice that the empty string is no longer part of your language, nor are the strings aabb, aaabbb, etc.

Chec the step where you eliminate useless rules. Is that second rule really useless?

Also, are you sure you can eliminate the epsilon production?

Upvotes: 0

Related Questions