简体   繁体   English

自动机正则表达式

[英]Automata-Regular Expression

I'm having problem understanding regular expression. 我在理解正则表达式时遇到问题。

I was trying this exercise: 我正在尝试此练习:

Over the alphabet {a,b}, create a regular expression that: 在字母{a,b}上,创建一个正则表达式:

A) Accept all the words that contains at least one occurrence 'a' or 'b'. A)接受所有包含至少一个出现的单词“ a”或“ b”的单词。

epsilon*(a U b ) epsilon *(a U b)

B) Accept all the words that have at maximum three 'a´s' B)接受所有最多具有三个“ a”的单词

C)All the words that ends with double letters (eg. abb ou abaa) C)所有以双字母结尾的单词(例如abb ou abaa)

epsilon*( aa U bb) epsilon *(AA U bb)

D)The words has exact one occurrence three aaa( eg. abaaab or baaab) D)单词恰好出现一次三个aaa(例如abaaab或baaab)

So, as you can see i'm having a lot of problems with regular expressions, i did the A and C ,but i think they're wrong, B e D i have no idea how to do. 因此,正如您所看到的,我在使用正则表达式时遇到很多问题,我做了A和C,但是我认为它们是错误的,B e D我不知道该怎么做。

Can i have some help.. 我可以帮忙吗..

A) Σ*.(a + b) A)Σ*。(a + b)
B) b* + b*.ab* + b*.ab*.ab* + b*.ab*.ab*.ab* B)b * + b * .ab * + b * .ab * .ab * + b * .ab * .ab * .ab *
C) Σ*.(aa + bb) C)Σ*。(aa + bb)
D) (ab + aab + b*)*.aaa.(ba + baa + b*)* D)(ab + aab + b *)*。aaa。(ba + baa + b *)*

You got A) and C) right idea-wise. 您有A)和C)正确的想法。 Also, it's Sigma for alphabet, not epsilon. 另外,它是字母的Sigma,而不是epsilon。 And you do not use U in regular expressions. 而且您不要在正则表达式中使用U。 It is expressed with the + symbol. +符号表示。 Only operations allowed are: 仅允许的操作是:
∅ - the empty set ∅-空集
ε - the empty word ε-空字
a, b - terminals in the alphabet a,b-字母中的终端
+ for unification +统一
* for 0+ symbols *表示0+个符号
. for concatenation 串联

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM