正则表达式 - Kleene明星

时间:2017-01-30 18:09:06

标签: lexical-analysis regular-language

之间有什么区别
 (0+1)* and (0*+1*)

我缺少某种分配属性吗?

1 个答案:

答案 0 :(得分:0)

+ seems to mean “or”在此背景下。

  

许多教科书使用符号∪,+或∨进行交替而不是垂直条。

*(Kleene Star)的意思是“重复多次”。

  • (0+1)*表示任意数量的01 s。

  • (0*+1*)表示任意数量的0或任意数量的1 s。

E.g。 111100000仅由第一个表达式0001110100匹配。

以下是(0+1)*(状态p 0 )和(0*+1*)的FSM(状态q 0 到q 3 < /子>):

p0 is an accepting state (the only state in this FSM), with a 0,1-transition looping back into itself. q0 is an accepting state, there are a 0-transition to q1 and a 1-transition to q2 (both accepting). They loop with a 0-transition from q1 to itself and a 1-transition from q2 to itself. Any other transition leads to the last, non-accepting state q3, including any transition from q3 itself.

使用Finite State Machine Designer by Evan Wallace

制作的FSM图表
相关问题