This project's syntax takes heavy inspiration from that found here.
Programming the Machine
All code must begin on the first line with "ATM" to specify that it is A Turing Machine
code.
Addtionally all code must end with "END" to specify the end.
Comments may be made as the final part of any line, but may not be on a line by themselves.
After the first line ("ATM") begins the configuration section, which is written as follows:
Line 2) The name of the machine (if downloaded, the file will have this name as well)
Line 3) The input alphabet, where each valid character is seperated from its nieghbor
by a space.
Example) "0 1" would be line 3 for a machine accepting bitstrings as input.
Line 4) The tape alphabet, where each valid character is seperated from its nieghbor by
a space.
--Note-- To include the blank character in the tape alphabet, use
'B'.
Exmaple) "0 1 B" would be line 4 for a machine able to read and write bitstrings and
the blank character.
Line 5) The number of tapes (n)
Line(s) 6 through 5 + n) The number of tracks for tape n. The number of tracks needs to be specified
for every tape.
Line(s) 5 + n + 1 through 5 + 2n) The infinite directions (1 or 2 way) for tape n. The infinite
directions needs to be specified for every tape.
Line 5 + 2n + 1) The initial state of the machine, i.e. the state the machine will begin at when the
run starts.
Line 5 + 2n + 2) The accepting/final states of the machine.
Line 5 + 2n + 3 begins the transition function section.
There can be any number of transition functions greater than or equal to 0.
Transition functions are written in the form "[state to be in for this function to be called]
[character(s) to read for this function to be called] [new state into which transition] [new
character(s) to write] [direction(s) to move tape head(s)]"
[character(s) to read for this function to be called] and [new character(s) to write] need to
be
characters of the tape alphabet
[direction(s) to move tape head] needs to be either "R" for right, "L" for left, or "S" for
stationary.
Be careful in writing a transition function with the same [state to be in for this function to be
called] and [character(s) to read for this function to be called] as another transition function. The
newer tranision fucntion will overwrite the previous.
There should be but one overly-complex line following the transition function section. "END" (or "end").
Running the Machine
To run the Turing Machine, enter any string of characters from the input alphabet into the text area
labled "Input" (read about multiple input areas in the "Multitracking and Multitaping" section) and then
press the "Run" button. Additionally, the "Step" button can be used to have the machine move forward by
a single step.
Upon pressing the "Run" button, it will convert to the "Pause" button, which will pause the machine
and allow for stepping. The machine can pick off from its current step at any time by pressing the "Run"
button again.
The speed at which the machine runs can be controlled by the slider labed "Speed".
The machine may be reset after halting by pressing the "Reset" button, which will reset all tapes and
tracks to their defaults.
Additionally, the machine may be reset with the curent output by pressing the "Rerun With Current
Output" button, which will only reset the current state to the start state and bring all tracks back to
their first cell.
The output for all tracks may be copied to the clipboard by pressing the "Copy Output" button. The
information will be in the form "tape0.track0: [output for tape 0's track 0]" on seperate lines for
every track on each tape.
Below the reset and copy buttons is the current state and recognized status of the input.
The current state of the machine will be displayed and updated when the machine's state
updates.
When the machine halts, it will display the recognized status of the input.
Mutitracking and Multitaping
To utilize multitracking, change the number of tracks for any given tape (for tape 0, the number of
tracks configuration is Line 6)
To utilize multitaping, change the number of tapes (Line 5)
For every tape, there needs to be a line to configure the number of tracks and the infinite
directions. (See more about this in the "Programming the Machine" section)
The reading and writing instructions for every transition function need to be
specified for each track. To do so, put each instruction next to each other with a "+" in
between. The first character in that sequence will be read/written on track 0, and the last will be
read/written
on the last track (top to bottom).
Example transition function for a 1 tape, 4 track machine: "initialState
1+0+1+0 nextState 0+1+0+1 R".
This example will be called when the state is "initialState" and the tracks read 1, 0,
1, 0 from top to bottom. It will write 0, 1, 0, 1 from top to bottom.
The movement instructions for every transition function need to be specified for
each tape. To
do so, put each instruction next to each other with a "+" in
between. The first instruction in that sequence will move track 0, and the last will move the last track
(top to bottom).
Example transition function for a 2 tape, 4 track machine: "initialState
1+0+1+0 nextState 0+1+0+1 R+L".
When this transition function is called, it will move tape 0 right and tape 1
left.
Miscellaneous
Example progams are included. To load an example, select one from the drop down menu labled
"Examples", and then press the "Load Example" button.
The current program can be copied by pressing the "Copy" button.
The current program can be downloaded by pressing the "Download" button. The text file downloaded will
have the name as specified on Line 2.
A downloaded text file can be loaded as the current program by pressing the "Load from File"
button.
A wildcard character can be used in the [character(s) to read for this function to be
called] section of any transition function to stand in place of any character.
For example, given a machine with tape alphbet "0 1 B" (that is 0, 1, and the
blank
character), the transition function "s0 * s1 0 R" will run weather the machine reads 0, 1, or the
blank character.
Note that an explicitly defined transition function will be choosen over a wildcard
transition function. That is, given a machine in state "s0" reading "0", the transition function "s0 0
s1 1 R" will have priority over "s0 * s1 1 R".
A wildcard character can be used in the [new character(s) to write] section to stand
for the character currently in the cell at which the tape head points.
For example, given the transition fucntion "s0 0 s1 * R", a machine in
state "s0" reading "0" will leave that 0 being read and move right.
Changing either the program code or any input string will result in the machine stopping.
Created by Kenneth Howes and Lillian McAboy