esolang

TEWNLSWAC

The Esolang Where No Line Starts With A Colon. Labels end with one instead.

Zseri · Turing complete: unknown · ●●○ moderate · esolangs.org

Tested with 3 known programs · Test method

Run it

Expected: 0

The idea

Zseri made TEWNLSWAC, said toons-whack, as a shorter TEWELSWAC with objects added. The name is the rule. A label is a name with a colon after it, so no line can start with one. Commands are one letter. p prints, g jumps to a label and e ends, and every command closes with a ;.

Read the story

Variables are global and hold whole numbers or strings. There is no loop and no else. A condition in parentheses guards a block in braces, and a loop is a label with a g back to it.

The machine

CodeDoes
X = expression;Set a global variable
p expression;Print a number or a string
name: g name;A label; jump to it
(expression) { ... }Run the block if the value is not 0
e;End
@ !Read a line; read a whole number
"text" 'cA string; a one-character string
= < > + - * / %Compare and compute; + also joins strings

Numbers are 32-bit ints, as the specification says, so they wrap around. This implementation leaves out the objects, methods, calls, namespaces, casts and floating point numbers of the full language.

Example

The truth machine compares the number it reads with 0 and jumps to F when they are equal.

The truth machine compares the number it reads with 0 and jumps to F when they are equal.

A countdown is a label, a print and a condition that jumps back.

Expected: 321
Expected: Hello, world!

The Fibonacci program has no last number. It loops while each number is at least the one before, which holds until B passes 2,147,483,647 and wraps below 0. So it prints 47 numbers, the last being 1,836,311,903, and stops.

Further

Also in Golfing

Write your own in Run Convert a program from TEWNLSWAC

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run tewnlswac -e '(0 = !) { g F; }
T: p "1\n";
g T;
F: p "0\n";' --input '0'
shib manual tewnlswac

Source

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

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

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