1
q1hello,
human!
Steps0
Space1
Ones1
Space1
Ones1
Speed
Zoom
Program Library
Examples
UnaryStringDuplication
IntegerMultiplication
Saved Programs
No saved programs
From your computer
Instructions
Basic Usage
All commands are separated by comma,
Declare machine's initial state
Use the
Eg:
initial
keyword.Eg:
initial q0
declares q0 as the initial state.Declare accept state
Use the
Eg:
accept
keyword.Eg:
accept qa
declares qa as the accept state.Declare reject state (optional)
Use the
Eg:
reject
keyword.Eg:
reject qr
declares qr as the reject state.Tuples
A tuple consists of the following:
- current state
- read symbol (truncated to the first character)
- next state
- write symbol (truncated to the first character)
- direction
l
(or-1
) means left,r
(or1
) means right
Q0 a Q1 b r
means: when you are at state Q0 and you encounter
symbol "a" on the tape, switch to state Q1, write "b" on the tape and move right.Calling one machine from another
You can create multiple machine programs and call the one machine from the other.
- Create a new program with the "New Program" button.
- Declare the machine's initial, accept/reject states and tuples according to your needs.
- Give that program a name e.g. IS_EVEN
- Now, to call IS_EVEN from another machine, use the exec command.
For example, if you want IS_EVEN to be called when you are at stateq1
and you read0
you should useq1 0 exec IS_EVEN
.
Specifying parent machine state after child machine executed (optional)
You can specify the parent machine state after the child machine has finished execution, depending on whether the child machine accepted or rejected.For example, the following command executes the machine IS_EVEN and then switches to state Qeven if IS_EVEN has accepted:q1 0 exec IS_EVEN Qeven
Furthermore, the following command switches to state Qeven if IS_EVEN has accepted or Qodd or if IS_EVEN has rejected:q1 0 exec IS_EVEN Qeven Qodd
If no states are specified for the accept or reject scenario, the parent machine keeps the last state of the child machine.