NFA for (a + b)? C

I need NFA for regular expression

(a+b)?c

As far as I understand, it should contain epsilon from zero node to node to the last (for example, to match the string "c").

To test my NFA, I use Regular Expression for the Visializaton NFA Web Service , but the graph for my regular expression on this service does not contain epsilon from a zero node.

Is this a maintenance error, or am I missing something?

Thanks!

+4
source share
2 answers

. (aa*b)?c, , NFA - ( ). , , , :

./fatool --in 're:^(a+b)?c$' --out dot:- | dot -Gdpi=70 -Tpng -onfa.png /dev/stdin Nfa

, : https://github.com/wader/libfa

+4

, . , a+? .

, a|, a?, HTTP- 500 .

, , , . , .

, . , , . , , , NFA DFA, . .

, , .

, . ε, . x y , : x·y, x|y x* .

: |, ·, *. , , . | · , , , (a·b)·c a·(b·c) a·b·c.

, , . , 'a', 'b' 'c'. , .

    --
    a
--  --
a   a*
-----   --
 a·a*   b
----------   --
  a·a*·b     ε
 --------------   --
   (a·a*·b)|ε     c
 ------------------- 
    ((a·a*·b)|ε)·c

.

x+ ≡ x·x*
x? ≡ x|ε
xy ≡ x·y

, , . + ? , *.

((a·a*·b)|ε)·c
((a+·b)|ε)·c
((a+b)|ε)·c
(a+b)?·c
(a+b)?c

. , , , - . , .

+3

Source: https://habr.com/ru/post/1623590/


All Articles