esolang

Uppercase=Lowercase

A counter machine that cannot tell a from A. Every small letter it reads or prints is a capital.

ChuckEsoteric08 · Turing complete: yes · ●○○ easy · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: HELLO, WORLD!

The idea

ChuckEsoteric08 made Uppercase=Lowercase with five instructions. Cells hold numbers, and the only test is the one inside dec, which jumps when a cell is too small to take from. That makes it a counter machine, and esolangs.org files it under Turing complete. The name is the one joke. A small letter that goes in or comes out is treated as its capital, so the Hello World says HELLO, WORLD!

The machine

InstructionDoes
lbl xDeclare the label x
inc x yAdd y to cell x
dec x y zIf cell x is less than y, jump to label z; else take y from cell x
inp xSet cell x to the code of one input character
out xPrint cell x as a character

Cells are counted from 1 and start at 0. Any number can be written *x, which means the value of cell x, so out *14 prints the cell that cell 14 points at. The run ends after the last line.

Example

The Hello World puts its 13 characters in cells 1 to 13 and walks cell 14 along them.

The Hello World puts its 13 characters in cells 1 to 13 and walks cell 14 along them. Cell 15 counts down from 12. dec 15 15 print always jumps back, because the count is always below 15.

The truth machine keeps the input's code in cell 2 and takes 48 and then 1 from cell 1 to tell 0 from 1. On 1 it prints 1 forever, since dec 2 50 always jumps back.

Expected: 0

Two small letters in, two capitals out.

Expected: OK

Patterns it teaches

Further

Also in Turing tarpits

Write your own in Run Convert a program from Uppercase=Lowercase

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: uppercase-lowercase.

Command line

shib run uppercase-lowercase -e 'inp 1
inc 2 *1

dec 1 48 terminate_on_error
dec 1 1  end_if_zero

lbl repeat_if_one
out 2
dec 2 50 repeat_if_one

lbl end_if_zero
out 2

lbl terminate_on_error' --input '0'
shib manual uppercase-lowercase

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/uppercase-lowercase.js

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

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