Tedius

From Esolang
Jump to navigation Jump to search

Tedius is an esoteric programming language designed to be as tedious as possible. In fact, even the creator of Tedius thinks Tedius is tedious!

Tedius was designed, written, compiled, re-written, and re-compiled by User:Pila, who had nothing better to do with his time. It is currently comprised of 9 commands, which can manipulate a bunch of bytes on a tape. brainfuck, which is Turing-complete, can be translated to Tedius, proving that Tedius is also Turing-complete. Its interpreter was written in Objective-C for Mac OS X, so those Windows users need to write their own interpreter.

Commands and syntax

In Tedius, everything is either a no-op or a command. A command looks like this:

[name] [argument];

Accordingly, every command ends with a semicolon (;) The command is separated from the argument by whitespace. Comments are written like this:

~ This is an extremely simple comment in such a tedious language ;

Comments must therefore begin with a tilde (~) and end in a semicolon. The nine commands are the following:

Command Description
INC Increase the memory cell value
SHF number Perform a bitwise left shift number times
OUT number Output ASCII value of memory cell number times
MVR number Move pointer right number spaces
MVL number Move pointer left number spaces
INT Output decimal value of memory cell (for debugging)
INP Get user input and store it in current byte
LBL number Create a label with identifier number
JMP [number] conditional jump to label with identifier [number]

Note that the WHL and NXT commands have been deprecated in favor of the LBL and JMP commands in Tedius 1.1; this allows for control structures to be nested.

So, a sample program would look something like this:

LBL 1;
 INP;  ~ get user input ;
 OUT; ~ output the input ;
JMP 1;

You can put several commands on a line like this:

INC;INC;INC;INC;INC;MVR;INC;INC;SHF 2;INC;

which only adds to the tediousness.

Control structures

Control structures can be created using the LBL and JMP commands. LBL creates a label and JMP jumps to it if the value of the current byte is not 0. It's possible to nest these control structures like this:

LBL 1;
 ~ blah ;
 LBL 2;
  ~ blah ;
 JMP 2;
 ~ blah ;
JMP 1;

or to jump to the same label in two parts of the code:

LBL 1;
 ~ do stuff ;
JMP 1;
 ~ do other stuff ;
JMP 1;

Limitations

Tedius has many limitations that make it tedious to code with.

Implementing subtraction

There is no direct subtraction in Tedius, and there never will be unless somebody makes a derivative of Tedius. In order to subtract x, one must call INC, 256 - x times. This takes advantage of the fact that the value of the byte wraps once the value reaches 256. If one doesn't want to type 'INC;' over and over again, they can either 1) copy and paste it, or 2) use this implementation:

~ set the byte to some value ;

MVR; INC;
LBL 1;
 INC;
 MVL;
 INC;
 MVR;
JMP 1; MVL;

Bitwise Shifts

One could, in theory, write Tedius code for a very long time without using the SHF command once, but who would want to increment a variable over and over? (Urban Müller) Instead, one could perform a combination of bitwise shifts and increments, so what once was

INC; INC; INC; INC; INC; INC; INC; INC; INC; INC;
INC; INC; INC; INC; INC; INC; INC; INC; INC; INC;
INC; INC; INC; INC; INC; INC; INC; INC; INC; INC;
INC; INC; INC; INC; INC; INC; INC; INC; INC; INC;
INC; INC; INC; INC; INC; INC; INC; INC; INC; INC;
INC; INC; INC; INC; INC; INC; INC; INC; INC; INC;
INC; INC; INC; INC; INC; INC; INC; INC; INC; INC;
INC; INC; INC; INC; INC; INC; INC; INC; INC; INC;
INC; INC; INC; INC; INC; INC; INC; INC; INC; INC;
INC; INC; INC; INC; INC; INC; INC;

could become

INC; INC; INC;
SHF 5; INC;

Translating brainfuck

brainfuck can be translated to Tedius like so:

brainfuck Tedius
+ INC
- (long string of INCs)
> MVR
< MVL
. OUT
, INP
[ JMP 2;LBL 1
] JMP 1;LBL 2

Example programs

Hello, world!

INC; SHF 3;
INC; SHF 3;
OUT 1;
SHF 8;
INC; SHF 1;
INC; SHF 3;
INC; SHF 2;
INC; OUT 1;
INC; INC;
INC; INC;
INC; INC;
INC; OUT 2;
INC; INC;
INC; OUT 1;
SHF 8;
INC; SHF 2;
INC; SHF 1;
INC; SHF 2; 
OUT 1;
SHF 8;
INC; SHF 5;
OUT 1;
SHF 8;
INC; SHF 2;
INC; SHF 2;
INC; SHF 1;
INC; SHF 1;
INC; OUT 1;
SHF 8;
INC; INC;
INC; SHF 2;
INC; SHF 1;
INC; SHF 1;
INC; SHF 1;
INC; OUT 1;
INC; INC;
INC; OUT 1;
SHF 8;
INC; INC;
INC; SHF 2;
INC; SHF 1;
INC; SHF 2;
OUT 1;
SHF 8;
INC; INC;
INC; SHF 3;
INC; SHF 2;
OUT 1;
SHF 8;
INC; SHF 5;
INC; OUT 1;
SHF 8;
INC;
INC; SHF 2;
INC; INC;
OUT 1;
SHF 8;

Cat program

LBL 1;
 INP; OUT 1;
JMP 1;

Interpreters

Tedius interpreters only accept files with the .tds extension.

Tedius 1.0 has been replaced with Tedius 1.1 which can be downloaded soon.