The source provided can be compiled in two separate ways: interpreter and crunched.
Interpreter is the recommended method for viewing the emulator's features, and is used as so:
nim c tm.nimThis line produces the executable tm as an interpreter, used as such:
./tm DESCRIPTION INPUTwhere DESCRIPTION is the name of a Turing machine description file (less the
.tm extension) and INPUT the string to test in the described TM.
The emulator will print, for each transition: the tape contents around the
selected cell; the name of the current state; and the number of iterations
since initialisation. If the emulation halts, true is printed if it halted
in an accepting state, and false is printed otherwise.
Crunched mode reads in a selected TM description file and creates an executable binary file capable of checking input strings for the described TM.
Crunching is done like so:
nim c -d:tmname=DESCRIPTION tm.nimAlternatively, a utility script compile has been included in the submission.
The following line crunches a TM description file woa.tm and produces
executable woa:
./compile woaUsing the cruched executable woa would be done like so:
./woa INPUTCrunched executables only output a true/false, and are
designed with testing and long-running emulation in mind.
A second program, mt.nim, is provided. It can read in the validation tests,
and create a TM that passes only on the input strings provided as true in the
test files. It can then output the description of this TM (if passed no
arguments), or run it against an input string. This program takes in the
validation test file at compile-time, like so:
nim c -d:tmname=VALIDATION mt.nimwhere VALIDATION is the name of the validation test file to be crunched, less
the file extension.
The emulator written in Nim takes any valid TM description file and creates an internal representation of the described TM in memory.