Two variable language

From Esolang
Jump to navigation Jump to search

Two variable language is an esolang by User:ChuckEsoteric08 based on B2C.

Specification

Language works on two variables, a and b, which store unsigned integers. Initially, a is set to 0 and b is set to 1

Commands

Pointer starts at variable a

+ - add values of current variable and other variable, store result in current variable
- - subtract value of current variable from other variable, store result in current variable. If result is less than 0, then halt
* - multiply values of current variable and other variable, store result in current variable
/ - divide value of another variable by value of current variable, store result in current variable. If current variable was 0, or value of another variable is not divisible by value of current variable, then halt.
% - divide value of another variable by value of current variable, store remainder in current variable. If current variable was 0, or value of another variable is not divisible by value of current variable, then halt.
!x - perform operation x with both arguments being current variable.
| - swap variables
( - if variable is not 0
) - end if
{ - while not 0
} - end while
[x - repeat commands x times. x is digit from 0 to 9
] - end repeat
. - output variable as an integer
, - input integer and set variable to it
; - input Unicode character and set variable to it
: - output variable as Unicode character.
$x - set variable to value of Unicode character x
digit from 0-9 - set variable to it
> - increment variable
< - decrement variable

Examples

Character-based Cat

;(:;)

Integer-based Cat

,(.,)

Hello, world!

$H:$e:$l::$o$,:$ :$w:$o:$r:$l:$d:$!:

Infinite loop

>(.>)