开发者

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

Th开发者_高级运维ere 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?


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜