开发者

Converting RE -> NFA

I have a question regarding the conversion of regular expressions to no开发者_Go百科n-deterministic finite state automata:

Convert (a*|b*)* to NFA. My attempt is as follows:

Converting RE -> NFA

Am I completely off the mark? Or somewhat there?

NB E => ε


Your NFA matches the same language as (a*|b*)*, so the answer is correct.

However, there are many NFAs that match the same language and in your case it would be possible to remove at least three epsilon arrows. Still, it will not be more correct than your suggestion.

The regex (a*|b*)* can also be simplified, without changing the semantics. E.g. (a|b)* is equivalent to (a*|b*)*. And if you think about it, the FA can be as simple as this:

Converting RE -> NFA

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜