Xt

From Esolang
Jump to navigation Jump to search

Xt is every Brainf**k derivative, on account of its odd syntax.
The name looks a little like ><+, part of the brainf**k syntax.

Syntax

An Xt source code file (.xt or .txt extension) consists of lines of eight characters each:

><+-.,[]
++[>+<-]

The odd numbered lines contain descriptions of brainf**k derivatives, with the eight characters replacing the >, <, +, -, ., ,, [, and ] characters respectively. The even numbered lines contain fragments of a program written in this language.
Using the same character across more than one odd-numbered line is a syntax error and the interpreter should loudly correct the user. However, it is not an error to use the same character more than once within one line.
The first line with less than 8 characters terminates the program.

Execution

The even lines are executed like a brainf**k program, with the characters redefined by the line above. If two commands are represented by the same character, the leftmost one in the definition is executed. When the end of the line is reached (or a loop sends execution to another line) the next even line will be run, and the characters will be redefined again.

Computational Class

Technically, Xt is trivially Turing-complete due to it being descended from brainf**k. However, the constantly dwindling supply of commands means that there is an upper limit on how long a program can be.
This is no different from any regular computer, though. At the very least, the finite size of the observable universe puts an upper limit on how big your program can be.

Example Program

Hello World I stole from the brainf**k page:

qqaaaaaa
aaaaaaaa
eepeeebb
beppppbe
oouuuuuu
uuouuuou
rfllllll
llrlffff
yyjhhhhn
hnyjyjyh
zxcvvvbm
zzcbxmxv
gggdsddk
kggsgddd
iittwwww
wttttttt
11223333
33222311
00000000
0.......

The periods in the last line pad it out to eight characters so the program doesn't stop short. They are not mapped to any command and work as no-ops.

See also