For this assignment, you may work in pairs (no groups of 3 or more will be permitted).
By putting more than one name on the assignment, you are stating that both people contributed significantly to each part.
Assignment: (worth 25 exercise points - however, there are 28 possible points available)For this assignment, log on to the Hardy House machines and changedirectory to where you wish this assignment to reside.
cp -r ~scottmce/208files/SimulateAutomata .
Note the period at the end of the previous line. This will copy a folder called SimulateAutomata to your directory. Your work will be in this folder and you will submit this folder.
You are welcome to do your work on your personal machine if you'd like, but you will need to upload your work to this directory when you are ready to submit.
0) (5 points) Consider representing a DFA with a text file with the following format:
An n-state automaton will be labeled by states 0 .. n-1.
Create text files with this format for the following automata. Use the filenames given.
1) (12 points) You are to write a C++ program that will take two command line arguments:
The first line of the file will contain a number indicating the number of lines remaining in the file. Each lilne will then contain a string. (note that a blank line will indicate an empty string)
Expected output format:
To the console, your program should report ACCEPTED or NOT ACCEPTED followed by a colon (space on each side of the colon) followed by the string itself. Your output should contain one line per string and no other output.
Sample output when using the example files above:
The program has been started for you in the file TestDFA.cpp. This program reads the command line arguments into variables for you to be able to read the info from the files.
A sample of what I will do to test your program:
g++ TestDFA.cpp -o runit.exe
./runit.exe DFAfromExam.txt SampleInputForDFAfromExam.txt
You will need to come up with your own testing inputs for each of the automata. The table below indicates the required filenames for the testing inputs:
Read the DFA file into the following variables:
vector < vector<int> > transitionTable;
vector <int> finalStates;
2) (6 points) Now, consider NFAs. Your task is to create:
In the folder, you should have the following files:
3) (5 points)
Create a subfolder called NamedStates. Create new data files and a program that allows the states to have names rather than just numbers. For instance, the 3 state automaton from the exam might have a file that looks like this:
Spot Fido Rover
Spot: Spot Fido
Rover: Spot Rover
Fido: Spot Rover
Note that the lines of the file indicating the rows of the transition table are now not in any particular order, but are first labeled with the current state of the transition.
Handin:Create a file called Names.txt in the folder. In that file should be the name(s) of the people who worked on this assignment. By putting a name here, you are indicating that all people contributed significantly to each part of the assignment.
To handin, the following command FROM WITHIN THE DIRECTORY WITH YOUR FILES.
handin cmsc208 labsimulate *
This will handin all of the files in the directory.