I'm trying to a develop a simulation that executes a non deterministic finite automaton in Java. The first command line argument is a text file that defines the machine. The second argument is an input string. If it accepts the string, it prints to standard output "accept" followed by a list of accept states it can end in. If it rejects, it outputs "reject" followed by a list of all possible end states.
For example, the text:
state 1 start
state 2
state 7 accept
transition 1 0 1
transition 1 1 1
transition 1 0 2
transition 2 0 2
transition 2 0 1
transition 2 1 1
transition 2 0 7
transition 7 0 7
transition 7 1 7
which looks like:
with an input string of 10 would output
reject 1 2
and with an input string of 000 would output
accept 7
I need advice on what data structures to use. I thought about using hashmaps and sets but I'm not sure.