Unique

From Esolang
Jump to navigation Jump to search

Unique made by User:Fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff is a programming language that can only use each number once.

Syntax

Each line must start with a line number, similar to BASIC. Lines can have multiple commands and each command must be ended with a semicolon.

Valid Lines:

1 PRINT "HI";
2 PRINT "HELLO"; PRINT "WORLD"; // Comments exist
3 PRINT "\"HI\"\n\WORLD"; 47;

Invalid Lines:

1 PRINT "HI" // (No semicolon)
2 PRINT "HELLO; // (Unterminated string)
PRINT 8; // (No line number)
4 FOR 1; // (Invalid command)
5+3i PRINT "HI"; // (Invalid Line Number)

Commands

PRINT thing          : Print out thing to stdout with a newline (If thing is a number, use it)
PRINT& thing         : Print out thing without a newline
GOTO  line           : Jump to line
IF x THEN y (ELSE z) : Pretty obvious
END                  : Ends
number               : Use up number

Operations

A+B
A-B (unary minus is allowed (-X) )
A*B
A/B
A%B
A HIGH B (Picks the biggest unused number between A & B)
A LOW B (Picks the smallest unused number between A & B)
A&B (Numbers are casted to booleans by checking if they have been used)
A|B (Numbers are casted to booleans by checking if they have been used)
~A
A>B
A<B
A==B
A!=B
A<=B
A>=B
!A (Numbers are casted to booleans by checking if they have been used)
?A (Numbers are casted to booleans by checking if they have been used)
INPUT (Nullary operation)
INPUTSTR (Nullary operation)

Order of execution

Lines are run in the order they are written, so this:

2 PRINT "TWO";
1 PRINT "ONE";

prints

TWO
ONE

Using up a number also deactivates the corresponding line, so:

1 2;
2 PRINT "HELLO";
3 PRINT "WORLD";

prints

WORLD

Used up numbers

Used up numbers evaluate to 2147483648

Examples

Hello, World!

1 PRINT "HELLO WORLD";

Truth-machine

2 INPUT; IF INPUT == 1 THEN 3; PRINT "0"; END;
3 PRINT "1"; GOTO 3;