ScripTur

From Esolang
Jump to navigation Jump to search

ScripTur An esoteric programming language based off of turing machine theory, written by Davy Wybiral in 2007.

Description

There are actually two parts of ScripTur that are important, the scripts which build the turing machines, and the input that becomes the tape of the turing machine. ScripTur takes a script file and builds a virtual turing machine from it, it then reads the command line argument as input for the intitial tape state. It's been said that any computable problem can be expressed on a turing machine.

Syntax

The script files have a very basic syntax. Each line of the script represents a state that the turing machine can be in (yes, you will need a text editor with numbered lines). On each line (in each state) the machine may have any number of conditions. Conditions are enclosed in parentheses and are laid out in this order...

(in, out, move, jumpToLine)

The turing machine will read the character at the character pointer (which starts at the first character in the input), if that character is equal to the "in" value, then it gets changed to the "out" value, the character pointer gets adjusted by the value of "move" (-1 moves to the left of the current character, 1 moves to the right), and then the machine jumps to the line designated by "jumpToLine".

If a line has more than one condition, it starts by checking the condition on the far left, if that one is false, then it moves to the next, and so on. The machine will end when a condition's "jumpToLine" value is 0 (the terminate command) or when there is no true condition for that line. To repeat a line, just make its "jumpToLine" equal to its own line. To leave a character unchanged, change it to itself. The input tape is infinite, you may go as far left as you'ld like, and as far right as you'ld like.

Examples

Hello world (no input):

(0,72,1,2)
(0,101,1,3)
(0,108,1,4)
(0,108,1,5)
(0,111,1,6)
(0,32,1,7)
(0,119,1,8)
(0,111,1,9)
(0,114,1,10)
(0,108,1,11)
(0,100,1,12)
(0,33,1,0)

Binary Incrementer (input in the form of a binary number):

(48,48, 1,1) (49,49,1,1) (0, 0,-1,2)
(49,48,-1,2) (48,49,0,0) (0,49, 0,0)

Adding Machine (input in the form of INTEGER+INTEGER):

(48,48,1,1)(49,49,1,1)(50,50,1,1)(51,51,1,1)(52,52,1,1)(53,53,1,1)(54,54,1,1)(55,55,1,1)(56,56,1,1)(57,57,1,1)(43,43,1,1)(0,0,-1,2) 
(48,57,-1,2)(57,56,-1,3)(56,55,-1,3)(55,54,-1,3)(54,53,-1,3)(53,52,-1,3)(52,51,-1,3)(51,50,-1,3)(50,49,-1,3)(49,48,-1,3)(43,0,1,5)
(43,43,-1,4)(48,48,-1,3)(49,49,-1,3)(50,50,-1,3)(51,51,-1,3)(52,52,-1,3)(53,53,-1,3)(54,54,-1,3)(55,55,-1,3)(56,56,-1,3)(57,57,-1,3)
(57,48,-1,4)(48,49,0,1)(49,50,0,1)(50,51,0,1)(51,52,0,1)(52,53,0,1)(53,54,0,1)(54,55,0,1)(55,56,0,1)(56,57,0,1)
(57,0,1,5)

External resources