This web application converts a given regular expression into respective NFA and DFA

The syntax of regular expression should use these rules:

  • Regular expression uses symbols { ".", "*", "(", ")", "|", "+" } as keywords to define itself.
  • To concatenate two regex R1 and R2:     R1 . R2
  • To make choice between regex R1 or R2:     R1 | R2
  • For Klene closure:     R*
  • For Klene plus closure:     R+
  • Brackets are used to give a part of expression priority over other parts.
  • Example of good regex:     (a|b)*, (a.b.c)+, (0)*.1.(0)*, a*.b
  • Example of bad regex:     a++, (*)+, (a|b|)*, a*b
  • Note: The web app is not designed to specifically reject bad regex, so it may cause unexpected results for them.

CONVERSION FROM REGEX TO NFA

Modified regex:

Nothing here


States:

array of states


Symbols used:

array of symbols


Input state:

input state


Final states:

Array of final states


Transition table for NFA:


STATES A B
q0 q1, q2 q2
q1 q2 q2,q4,q5
q2 q2.q3,q5 q2

CONVERSION FROM NFA TO DFA

States:

array of states


Symbols used:

array of symbols


Input state:

input state


Final states:

Array of final states


Transition table for DFA: