esolang

Tory

Programs are Conservative election pledges. Only eight kinds of word do anything.

Philip McCarthy · Turing complete: with unbounded memory · ●●○ moderate · esolangs.org

Tested with 4 known programs · Test method

Run it

Expected: Hi

The idea

Philip McCarthy based Tory on l33t. The machine is the same, 65,536 bytes of memory and a pointer that wraps at both ends, but the opcodes are now words from a manifesto. Spending raises a byte, cuts lower it, jail and deport move the pointer, immigration prints, taxes read, and hospitals and schools make a loop. Every other word does nothing, so a program can read as a speech.

Read the story

The code sits in its own block of memory, so unlike l33t a program cannot change itself, and it needs no END. It stops when it runs out of words.

The machine

WordDoes
ImmigrationPrint the byte under the pointer
TaxesRead a byte into it
Spend, spends, spendingAdd the next word's worth plus 1
Cut, cuts, cuttingTake the next word's worth plus 1
Jail, jails, jailingMove the pointer forward by that much
Deport, deports, deportingMove it back by that much
HospitalsJump past the matching Schools if the byte is 0
SchoolsJump back after the matching Hospitals if it is not 0

Case and punctuation do not matter. A word is worth the sum of its digits, as in l33t, so £5 is worth 5 and billions is worth 0. The word after a spend, cut, jail or deport is used up as its argument.

Example

The first pledge is worth 71, so the byte becomes 72, an H.
Expected: A

The first pledge is worth 71, so the byte becomes 72, an H. The second adds 33 for an i. The pledge Spending £5 billion to limit immigration adds 6 and prints a byte 6.

The endless loop raises one byte, then jails twice to move two bytes on, spends, prints and deports twice to come back. Schools sends it round again, so it prints 1, 2, 3 and on through 255 and 0 for ever.

Further

Ideas it shows

Tory builds on Brainfuck.

Unknown year

Brainfuck derivatives

Write your own in Run Convert a program from Tory

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: tory.

Command line

shib run tory -e 'Deport me, cut me, jail me'
shib manual tory

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/tory.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org