regex - RE to NFA Thompson's construction steps ((c|a)b*)* -


i tried convert ((c|a)b*)* nfa using thompsom's construction have understood wrong because outcome isn't 1 supposed be. glad if point mistake. thompson's construction rules:

  • 1)every nfa has start state , accepting state.
  • 2)no transition, except starting one, allowed enter start state.
  • 3)no transition exits accepting state.
  • 4)an ε-transition connects 2 states used start or accepting states res
  • 5)a state can have @ maximum 2 incoming , 2 exiting ε-transitions
  • 6)a state can @ maximum 1 incoming , 1 exiting transition specific character of alphanumerics used.

    step 1: created nfas each character

enter image description here

enter image description here

enter image description here

step 2: parenthesis have priority created c|a enter image description here

step 3: created b*

enter image description here

step 4: combined c|a , b* create (c|a)b*

enter image description here

step 5: , @ last created ((c|a)b*)* enter image description here

the difference correct solution in last nfa (the example doesn't show steps , states got renumbered in end) there no s9. s8 ε-transists s5 , s5 ε-transists s10. makes sense me if b* didn't have s9 state needs because of rule number 2. guess made mistake during connection. thank in advance.

rule 2 says nothing can enter s11, isn't relevant here. when concatenating (step 4), s8 , s9 should have been combined.

from wikipedia,

the concatenation expression st converted to

concatenation


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -