Turin
- This article is not detailed enough and needs to be expanded. Please help us by adding some more information.
Turin is based of Turing-machine, employing an infinite tape of bit-valued cells in conjunction with a very simple state machine.
Architecture
There is an infinite tape of bit-valued cells, all starting by default with 0. A pointer exists pointing at the currently selected cell.
There is also a state, that defaults to START
.
Syntax
The program starts with an header which determines the format expected by the input and output facilities:
IN <mode> OUT <mode>
The mode
may assume the following options: ASCII
(signifies ASCII text input or output), BIN
for direct binary transmission, and HEX
in order to entertain communications in the hexadecimal format.
The example
IN ASCII OUT ASCII
specifies that the input was interpreted as ASCII text. It is then converted to binary and transferred to the tape.
First, a command starts with a conditional:
<activatingState>~<activatingSymbol>
The activatingState
imposes the state requisite for the commands' execution, completed by the necessity of the bit-valued activatingSymbol
to be satisfied by the tape's current cell, whence ensues the ultimate action.
For instance with
START~0
the following commands are executed if current state is START
and the value under the pointer was 0
.
Commands
Command | Description |
---|---|
> | Move pointer left |
< | Move pointer right |
0 | Write a 0 under the pointer |
1 | Similar to 0 except that it writes a 1 |
Examples
Hello world
Hello world:
OUT ASCII IN ASCII START~0:0>1>0>0>1>0>0>0>0>1>1>0>0>1>0>1>0>1>1>0>1>1>0>0>0>1>1>0>1>1>0>0>0>1>1>0>1>1>1>1>0>0>1>0>1>1>0>0>0>1>1>1>0>1>1>1>0>1>1>0>1>1>1>1>0>1>1>1>0>0>1>0>0>1>1>0>1>1>0>0>0>1>1>0>0>1>0>0>0>0>1>0>0>0>0>1>
To create this, first I convert the phrase Hello,World! into binary. Then I added > in between.
Hexadecimal Output
This program replicates the text “FACE” on the tape by mediation of the respective hexadecimal digits, whose bits form the catena 1111 1010 1100 1110
:
OUT HEX IN HEX START~0:1>1>1>1>1>0>1>0>1>1>0>0>1>1>1>0
Interpreter
- Common Lisp implementation of the Turin programming language.