Something

From Esolang
Jump to navigation Jump to search
Something
Paradigm(s) Imperative
Designed by User:PixelatedStarfish
Appeared in 2021
Memory system Cell-based
Computational class Turing complete
Major implementations Interpreter (Java)
Influenced by bf, ARM64
File extension(s) .some


Something is a low level programming language created by User:PixelatedStarfish. The only error message in the language is the phrase Oops! Something went wrong!

Something is similar to that most famous of languages by Urban Müller, referred to here as brainfood. Like brainfood, in Something, cells on a tape can store values from 0 to 255, and a pointer can read and write to a cell. Unlike brainfood, Something has an unbounded tape, and it has 13 instructions instead of 8.

Instructions

Instructions move the pointer and modify cells. Some instructions can take one argument separated by a space, which must be an integer. Instructions are separated by a newline.

Instructions
Instruction Description
MOV V moves the pointer V cells on the tape
ADD V Add V to the current cell
SUB V Subtract V from the current cell
INP Set cell to input (throws exception if input is not between 0 and 255 inclusive)
LBL L A label L
GTO L Go to label L
CBZ L Go to L if the current cell is zero.
CHR Print value of cell as an ASCII character
VAL Print value of cell
TAS move pointer to start of tape
ZER set cell value to zero
QNE Prints “QNE” (a Quine)
HLT Halt, end program

A comment is written with angle brackets:

<this is a comment>
<
this is a multiline comment
>

Program Examples

Hello World

ADD 72
CHR 
ZER
ADD 69
CHR 
ZER
ADD 76
CHR 
ZER
ADD 76
CHR 
ZER
ADD 79
CHR 
ZER
ADD 32
CHR 
ZER
ADD 87
CHR 
ZER
ADD 79
CHR 
ZER
ADD 82
CHR 
ZER
ADD 76
CHR 
ZER
ADD 68
CHR 
ZER

Truth Machine

INP
CBZ 0
LBL 1
<set to one for the machine>
ZER
ADD 1
VAL
GTO 1
LBL 0
VAL

Quine

QNE

Proof of Turing completeness

Brainfood is Turing complete. By translating each brainfood command to Something, it can be shown that Something is also Turing complete. (Note that ' :: ' is a stand-in for a newline.)

Conversion Table
Something Brainfood Desc
MOV 1 > increment
MOV -1 < decrement
ADD 1 + add 1 to cell
SUB 1 - take 1 from cell
CHR . Output ASCII value at cell
INP , Take input at cell
CBZ X [ Jump past ' ] ' (to label X)
CBZ X :: GTO Y :: LBL X ] goto ' [ ' (label Y) if cell is greater than 0

External Resources

Interpreter (Java)