We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Tory

From Esolang
Jump to navigation Jump to search

The Tory programming language is an esoteric language where programs consist of Conservative election pledges. Tory was created by Philip McCarthy, and is based mainly on l33t.

Language overview

Tory uses two blocks of memory. The program code is loaded into the first one, unlimited in size. A second block of 64K comprises the memory space operated on by the program, which means that code cannot modify itself and that END instruction is not needed.

Tory has two pointers: a memory pointer and an instruction pointer. The instruction pointer begins at the start of the program, and executes the instructions it encounters. Each instruction will modify the pointer (see Tory#Commands). If the instruction pointer will try to move past the end of the program code, execution will terminate with an error.

The memory pointer starts at byte 0 of the memory block, and is moved by the instructions of the program. If the memory pointer moves past the beginning or end of the 64K block, it will wrap round to the other end.

Commands

Instruction Opcode Description
Any word not listed here NOP No Operation, except to increment the instruction pointer.
Immigration WRT Writes the ASCII values of the byte under the memory pointer to stdout. Increments the instruction pointer.
Taxes RD Reads a character from stdin and writes it to the byte currently under the memory pointer. Increments the instruction pointer.
Hospitals IF Moves the instruction pointer forward to the command following the matching EIF, if the byte under the memory pointer is equal to zero. If the byte under the memory pointer does not equal zero, IF simply increments the instruction pointer.
Schools EIF Moves the instruction pointer backwards to the command following the matching IF, if the byte under the memory pointer is not equal to zero. If the byte under the memory pointer does equal zero, EIF simply increments the instruction pointer.
Jail, jails, jailing FWD Move memory pointer forward by (next token+1) bytes. Adds 2 to the instruction pointer.
Deport, deports, deporting BAC Move memory pointer backward by (next token+1) bytes. Adds 2 to the instruction pointer.
Spend, spends, spending INC Increment value of the byte under memory pointer by (next token+1). Adds 2 to the instruction pointer.
Cut, cuts, cutting DEC Decrement value of the byte under memory pointer by (next token+1). Adds 2 to the instruction pointer.

Examples

Endless loop outputting ASCII values 0—255:

We will spend more on hospitals!
We will jail anyone not in jail already!
We will spend billions limiting immigration!
We will deport anyone we can deport!
We will abolish schools!

Increments current byte by 6 and writes it to stdout:

Spending £5 billion to limit immigration

Reads stdin into current byte and then decrements it by 1:

Raise taxes to cut waiting lists

While the current byte is non-zero, decrement it by 1:

Hospitals face cuts, as do schools.

Move to the previous byte, decrement it and move forward again:

Deport me, cut me, jail me

External resources