esolang

Something?Oops!

One statement that adds two numbers. Where the sum goes decides whether it prints, jumps or just stays.

A, 2018 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: 1 2 3

The idea

Something?Oops! is a 2018 language by the user A. Every statement has the same form, A B?Oops C, and it stores A + B in C. There is no print command, no input command and no goto. The four variables do that work, and what a statement does depends only on which variables it reads and writes.

The machine

VariableReadWritten
!Its valueStores the value
?Reads a number from the inputNothing happens
.Its valueStores and prints the value
,The number of this statement, from 1Jumps to that statement

A and B are whole numbers or variables. Each printed number gets its own line, and the run ends after the last statement or at a jump outside the program.

Example

The counter prints 1, 2 and 3 by reading the statement counter.

The counter prints 1, 2 and 3 by reading the statement counter.

The truth machine jumps to statement input + 2. On 0 that is statement 2, which jumps on to 5 and prints 0. On 1 it is statement 3, which prints 1, and statement 4 sends it back to 3 for ever.

Expected: 0

Patterns it teaches

  • One instruction: addition is the only operation, and side effects hide in the variable names.

Further

Also in Turing tarpits

Write your own in Run Convert a program from Something?Oops!

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run something-oops -e '0 ,?Oops.
0 ,?Oops.
0 ,?Oops.'
shib manual something-oops

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/something-oops.js

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

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