Skip to content

Latest commit

 

History

History
38 lines (32 loc) · 953 Bytes

README.md

File metadata and controls

38 lines (32 loc) · 953 Bytes

DFA and NFA2DFA

Here are my Formal Languages and Automata course programming assignments.
dfa.py reads a DFA from DFA_Input_1.txt file and gets a string from input. It outputs whether input string was accepted by DFA.
nfa_to_dfa.py reads a NFA from NFA_Input_2.txt and writes equivalent DFA to DFA_Output_2.txt.

Input file format

  • First line are alphabet separated by space.
  • Second line are automata states separated by space.
  • Third line is initial state.
  • Fourth line are terminal states separated by space.
    The rest of lines determines transitions. Each line specifies one transition:
<current state> <letter> <next state>

Sample input file

0 1
q0 q1 q2
q0
q1
q0 λ q1
q0 0 q1
q1 0 q0
q1 1 q1
q1 0 q2
q1 1 q2
q2 0 q2
q2 1 q1

More description

Full description (in Persian) is here.