I'm having a bit of trouble with defining the trace function within an implementation file for an FSA (Finite State Automaton) program. I've been looking all over the web for possible hints, but my professor has a very specific format that he wants us to abide to (i.e. we can't change the method of creating the FSA, tracing it, etc.).
This is my professor's description of what the trace() function should do:
trace(), a void function taking one string parameter. The statement “fsa.trace(in_string);” traces the operation of the FSA object fsa on the input string in_string, indicating whether or not fsa accepts in_string at the end of the trace.
From my understanding, the trace function goes through, or "traces", the input string and based on the last character of the string, if the FSA is at an accept state, accepts the input string. However, I'm having a lot of trouble visualizing how I would be going through the string and the FSA, and where to begin with it, besides implementing some kind of for loop.
The other functions included are an FSA constructor function and a get_state_table, which have ifstream parameters that read in data from a text file.
I haven't worked with C++ in a while, so any hints or tips would be greatly appreciated.
Aucun commentaire:
Enregistrer un commentaire