esolang

EsoBASIC

BASIC cut down to ten commands. Variables count up and down, and IF only asks whether one is 0.

Yes, 2022 · Turing complete: yes · ●●○ moderate · esolangs.org

Tested with 4 known programs · Test method

Run it

Expected: Hello, World

The idea

EsoBASIC was made in 2022. It looks like an old BASIC with line numbers, but arithmetic is gone. LET += x adds one and LET -= x takes one away, and IF x skips the next line when x is 0. That is a Minsky machine, so the language is Turing complete, and the specification links a compiler from 3-register Minsky machines to EsoBASIC. The square program squares its input with nothing but those three operations.

The machine

CommandDoes
PRINT textPrint the text
PRINTVAR xPrint x
INPUT xRead x
LET xCreate x as 0
LET += x LET -= xAdd one, subtract one
IF xSkip the next line if x is 0
GOTO nGo to line n, counting from 1
CLS ENDClear the screen, stop

Example

The second is the truth machine.
Expected: 0

The second is the truth machine. With 0 the IF skips the GOTO and the program prints 0. With 1 it jumps to line 7, which is END, so this copy of the truth machine stops instead of printing 1 forever.

Further

Ideas it shows

Also in Turing tarpits

Write your own in Run Convert a program from EsoBASIC

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run esobasic -e 'CLS
PRINT Hello, World
END'
shib manual esobasic

Source

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

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

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