Alright, i have no idea on how to start this. I am trying to write a program that reads in a deterministic finite automata followed by one or more strings. This program should run each of the input strings through the automata and output if the string is part of the language defined by the automata.
The input is a text file. The format of the file is as follows:
comment
number of states
starting state, input symbol, next state
…
final states – on same line
strings
file:
Code:
‘Ends in a
2
S, a, A
S, b, S
A, a, A
A, b, S
F: A
aba
bbaabba
bbabab
aaaab
b
a
The machine will begin in the state listed with the first transition. In this example ‘S’. The final states will be listed at the end of the automata and marked with ‘F:’ (F will never be a state).
Following the final state will be the list of strings to run through the machine.
Code:
aba
bbaabba
bbabab
aaaab
b
a
I have no code to show because i dont know how to start this. Do i read the whole contents into a data structure of some sort? Then, loop to check for alpha, upper case / lower?
whats got me puzzled in the deterministic finite automata is defined in a file. Should i use a delimitier like comma newline and space to break up the file contents? Can someone help?