<!DOCTYPE HTML PUBLIC "-//Norman Walsh//DTD DocBook HTML 1.0//EN">
<HTML
><HEAD
><TITLE
>Program File Format</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet"><LINK
REL="HOME"
TITLE="GNOME Turing Machine simulator user guide."
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="States View"
HREF="dialogs.html"></HEAD
><BODY
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>GNOME Turing Machine simulator user guide.</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="dialogs.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
>&nbsp;</TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="PRGFMT"
>Program File Format</A
></H1
><P
>Any empty line or any line beginning with a hash (#) is ignored. In other
case, five tokens, each separated by a space, are expected. These are the
state number, the expected symbol, the symbol to write, the direction to
move, and the new state. Anything following these tokens is ignored.</P
><P
>Expected symbols and symbols to write can be any printable character.
The blank character is represented by the underscore (_). States are integer
numbers, starting from 0. The possible directions to move are left and
right, represented by 'l' and 'r', respectively.</P
><P
>The machine starts at state 0 and stops when it cannot find the new state or
the new state doesn't expect the read symbol.</P
><P
>It is important to note that, as the machine's tape is supposed to be of
infinite length, the tape will have an infinite number of blank spaces
appended at each end of what the user set as the tape's contents.</P
><P
><DIV
CLASS="EXAMPLE"
><P
><B
>Example 1. Binary ++</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
># This program adds 1 to a binary number. The initial tape must be a binary
# number.

0 1 1 r 0 Move to the rightmost digit of the binary number. Then, goto 
0 0 0 r 0 state 1.
0 _ _ l 1
1 1 0 l 1 If there is a 1, change it for a 0 and move left.
1 0 1 r 2 If there is a 0, change it for a 1 and goto state 2
1 _ 1 r 2 Same for the blank space.

# As there is no state 2, the machine stops.</PRE
></TD
></TR
></TABLE
></DIV
>
	</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="dialogs.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>&nbsp;</TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>States View</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>&nbsp;</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>