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
.
- 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>
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
Full description (in Persian) is here.