From home, be prepared for several hours download time (try overnight).
The file is a self-extracting executable. It should install into the directory C:\jdk1.1.4 (or later). Check the installation notes if you are using IBM’s ADK.
If you plan to develop programs in Java, download the "api documentation"
and unzip it using a 32-bit (long file name) "unzipper." Unzip to
C:\ with directory options on; in this way it unzips to C:\jdk1.1.4\docs
(or later). Also download the Java tutorial when you can (Binghamton students
should let me know if they cannot find the tutorial.zip file). The tutorial
has to be unzipped into the directory it will use, e.g., C:\jdk1.1.4\tutorial.
For your own PC, download the file fsmsim_bgm.zip
(Windows) or fsmsim_bgm.tar
and unzip from your root directory. These zip files include this document
and the associated gif's. We recommend that you keep the files in the directories
shown and add C:\classes your CLASSPATH variable, despite the current
recommendation from Javasoft not to use a CLASSPATH. The files provided
are:
classes/FSM.class
classes/fsm/control/MachineDescriptionFSM.class
classes/fsm/control/MainFrame$1.class
classes/fsm/control/MainFrame$2.class
classes/fsm/control/MainFrame$3.class
classes/fsm/control/MainFrame$4.class
classes/fsm/control/MainFrame.class
classes/fsm/display/CButton.class
classes/fsm/display/Controller$1.class
classes/fsm/display/Controller$2.class
classes/fsm/display/Controller$3.class
classes/fsm/display/Controller$4.class
classes/fsm/display/Controller$5.class
classes/fsm/display/Controller.class
classes/fsm/display/GraphCanvas$CurrentStateColor.class
classes/fsm/display/GraphCanvas$Edge.class
classes/fsm/display/GraphCanvas$FinalNode.class
classes/fsm/display/GraphCanvas$Node.class
classes/fsm/display/GraphCanvas$StartFinalNode.class
classes/fsm/display/GraphCanvas$StartNode.class
classes/fsm/display/GraphCanvas.class
classes/fsm/display/MachinePanel$1.class
classes/fsm/display/MachinePanel$InputActionListener.class
classes/fsm/display/MachinePanel.class
classes/fsm/display/TapeDraw.class
classes/fsm/display/TextDriver$InputData.class
classes/fsm/display/TextDriver.class
classes/fsm/display/Viewer.class
classes/fsm/machine/dfa/DFAMachine.class
classes/fsm/machine/dfa/Function$Enumerator.class
classes/fsm/machine/dfa/Function.class
classes/fsm/machine/nfa/NFAMachine.class
classes/fsm/machine/nfa/Relation$Enumerator.class
classes/fsm/machine/nfa/Relation.class
classes/fsm/machine/Alphabet.class
classes/fsm/machine/DefineRelationship.class
classes/fsm/machine/EndOfInputException.class
classes/fsm/machine/InputException.class
classes/fsm/machine/InputPair.class
classes/fsm/machine/InputTuple.class
classes/fsm/machine/Machine$InputTape.class
classes/fsm/machine/Machine.class
classes/fsm/machine/MachineException.class
classes/fsm/machine/OutputTuple.class
classes/fsm/machine/SetOfStates.class
classes/fsm/machine/State.class
classes/fsm/machine/Tuple.class
classes/fsm/xqt/RunMachine.class
classes/fsm/xqt/XQTThread.class
classes/DetailTextFSM.class
classes/GraderFSM.class
classes/QuickTextFSM.class
fsm_source/dfa1.txt
fsm_source/dfa2.txt
fsm_source/dfa3.txt
fsm_source/fsm1.gif
fsm_source/fsm10.gif
fsm_source/fsm11.gif
fsm_source/fsm12.gif
fsm_source/fsm13.gif
fsm_source/fsm14.gif
fsm_source/fsm15.gif
fsm_source/fsm2.gif
fsm_source/fsm3.gif
fsm_source/fsm4.gif
fsm_source/fsm5.gif
fsm_source/fsm6.gif
fsm_source/fsm7.gif
fsm_source/fsm8.gif
fsm_source/fsm9.gif
fsm_source/fsmdoc.html
fsm_source/inputd1.txt
fsm_source/inputd2.txt
fsm_source/inputd3.txt
fsm_source/inputn1.txt
fsm_source/nfa1.txt
fsm_source/nfa2.txt
fsm_source/nfa3.txt
fsm_source/nfa4.txt
fsm_source/nfa5.txt
(the path shown is for UNIX, you get the equivalent on a WINDOWS machine)
Note that Java is case sensitive, even on directory names.
Add the following two lines after any other modification to the path
set path = %path%;c:\jdk1.1.4\bin set CLASSPATH = c:\classesDespite suggestions in the Java installation files, we find this CLASSPATH very convenient. On bingsuns you have to modify the file ".cshrc" to add the lines (check which is the latest jdk)
setenv PATH ${PATH}:/opt/local/java/jdk1.1.4/bin
setenv CLASSPATH /u0/users/A/head/classes:<your login path>/classes
If you click on "Machine" in the Menu Bar, you pull down the options "New Machine" and "Restart," as shown in Figure 2.
When you click on "New Machine," you get a File Dialog Box, which allows you to open a file that contains a description of the finite state machine that you are about to test, see Figure 3.
You select and open the appropriate file. The format for the file is described later. The simulator will load and display the states of the machine and the transitions between the states, see Figure 4. If there are detectable errors in the format of your machine these will be reported in your command window. Resize the window to allow you to spread out the states in the black area on the screen. The states are distributed at random on the screen and you can drag them with the mouse to any location in the black area, Figure 5.
Next you should insert an input string. If you do not, the input will be assumed to be the empty string. To insert an input string, click in the empty text field next to the label "Input." Type in the input string, Figure 6, and click the button "Accept Input Tape" OR hit enter Figure 7.
The control bar allows you to proceed one step at a time (by pressing "Step") or run continuously at different speeds (by pressing one of the smaller buttons, which will show up red). See Figure 8.
300 16 11110101111110 11110101111110111110 101010 1010100 10101010 000 0000 1010101010 101010100 11111111 0 00 00000 0110111 01To run the grader's version, type the following:
java GraderFSMor
java GraderFSM inputd1.txtor
java GraderFSM inputd1.txt dfa1.txtIf the command-line parameters are not provided, there will be prompts to ask for them.
C:\fsm_source>java GraderFSM Enter Input File Name: inputd1.txt TITLE: NEW MACHINE Enter Machine FileName: dfa1.txt TITLE: DFA: Example 1--Eileen Head--Language: \ + 1* 0 1* 0 1* 0 + ... YES YES YES YES YES YES YES YES MachineException: Input :Q4,1 has no next state MachineException: Input :Q4,0 has no next state YES NO NO MachineException: Input :Q4,0 has no next state NO NO Another Machine? Y/N
java QuickTextFSMor
java QuickTextFSM inputd1.txtor
java QuickTextFSM inputd1.txt dfa1.txtor
java QuickTextFSM inputd1.txt dfa1.txt logd1.txtIf the parameter "logd1.txt" is not provided, the default is "report.txt." If the other parameters are not provided, there will be prompts to request them. The file of test cases inputd1.txt is the same as before. The following example shows the use of the same FSM dfa1.txt, which was used above.
C:\fsm_source>java QuickTextFSM inputd1.txt
TITLE: NEW MACHINE Enter Machine FileName: dfa1.txt
TITLE: DFA: Example 1--Eileen Head--Language: \ + ... Ready? returnThe program reports on whether the FSM accepted a particular input from the file inputd1.txt, in this case. The reports come in groups of 5. Examples include the following (the first example is a test with a blank input):
INPUT: STATUS: DFA: Example 1--Eileen Head--Language: \ + 1* 0 1* 0 1* 0 + 1* 0 1* 0 1* 0 1* 0 ACCEPTED after Step: 1 INPUT: 11110101111110 STATUS: DFA: Example 1--Eileen Head--Language: \ + 1* 0 1* 0 1* 0 + 1* 0 1* 0 1* 0 1* 0 ACCEPTED after Step: 15 INPUT: 00 STATUS: DFA: Example 1--Eileen Head--Language: \ + 1* 0 1* 0 1* 0 + 1* 0 1* 0 1* 0 1* 0 NOT Accepted after Step:3 INPUT: 00000 MachineException: Input :Q4,0 has no next state INPUT: 0110111 STATUS: DFA: Example 1--Eileen Head--Language: \ + 1* 0 1* 0 1* 0 + 1* 0 1* 0 1* 0 1* 0 NOT Accepted after Step:8The same information shown on the screen is saved in the log file (default name: report.txt).
java DetailTextFSMor
java DetailTextFSM inputd1.txtor
java DetailTextFSM inputd1.txt dfa1.txtor
java DetailTextFSM inputd1.txt dfa1.txt logd1.txtIf the parameter "logd1.txt" is not provided, the default is "report.txt." If the other parameters are not provided, there will be prompts to request them. On the screen the results of each test are shown in exactly the same way as for the QuickTextFSM program described above (accept/reject/failure on account of a missing transition) with the name of the machine, the test input, the state where execution ended. The big difference is in the log file. Note that in this version, after each run of the simulator, you may also change the FSM, keeping the same input file (this feature is provided specifically for the grader who might be diagnosing the failure of students' work).
The format of the log file is shown in the following examples taken from dfa1.txt and inputd1.txt
TITLE: DFA: Example 1--Eileen Head--Language: \ + ... INPUT: SNAPSHOT: START State:Q0 SNAPSHOT: Input Tapes: SNAPSHOT: SNAPSHOT: SNAPSHOT: Stopped ACCEPTED after Step: 1
INPUT: 11110101111110 SNAPSHOT: START State:Q0 SNAPSHOT: Input Tapes: SNAPSHOT: 11110101111110 SNAPSHOT:
SNAPSHOT: Step number: 1, Current State: Q0 SNAPSHOT: 1110101111110
SNAPSHOT: Step number: 2, Current State: Q0 SNAPSHOT: 110101111110
...
SNAPSHOT: Step number: 13, Current State: q2 SNAPSHOT: 0
SNAPSHOT: Step number: 14, Current State: Q3 SNAPSHOT: SNAPSHOT: Stopped ACCEPTED after Step: 15
...You can see the current state and remaining input at each step of the simulation. The file is a sequence of snapshots of the simulation, one for each cycle of the simulator program.
If the user does not get the expected result when viewing the on-screen
report, the log file can be used to isolate which state/input combination
caused the problem.
Line 1: type of machine (DFA, NFA)
Line 2: name of the machine. For assignments use name(s) and question
number
Line 3: all characters in the alphabet, separated by spaces
Line 4: the sates of the machine, separated by spaces
Line 5: the initial state of the DFA machine
Line 6: all the final state(s) separated by spaces. The list could
be empty
Line 7: first of a list of transition (see below)
Line 8: another transition
...
Line ?: last of the list of transitions
Last line: end. You must type the word "end" but it can be upper or
lower case
The format of a transition is:
<state> <input symbol> <next-state>
where
DFA //Type, note such comments are permitted at the end of
the line
Example 1--Hopcroft/Ullman--Language: {w in (0+1)* : #0's
is even & #1's is even} //Title
0 1 // input alphabet, single symbols separated by spaces
q0 q1 q2 q3 // Machine states (strings): note: alphabet and
states are CASE-SENSITIVE
q0 // the initial state, required--cannot be empty
q0 // final state(s)--can be empty, in which case language
is empty
q0 0 q2 // transitions: input state, input
symbol, output state
q0 1 q1 // do not forget there must be a
space before the "slashes"
q1 0 q3
q1 1 q0
q2 0 q0
q2 1 q3
q3 0 q1
q3 1 q2
end //required, this line is not case-sensitive
Example 2 In the NFA, "\" signifies an empty transition
NFA //Type
Example--Les Lander //Title
a b // input alphabet, note such comments are permitted at
the end of the line
q0 q1 q2 q3 q4 q5 q6 // Machine states
q0 // the initial state
q2 q4 // final state
q0 b q4 // transitions: input state, input
symbol, output state
q0 \ q1 // epsilon (lambda) transition,
"\" denotes lambda
q1 a q5
q1 b q2
q2 a q3
q2 \ q5
q3 b q2
q3 b q4
q3 \ q2
q4 b q6
q4 \ q2
q5 \ q0
q6 a q6
q6 \ q0
end //required
Comments?