Bananaban

From Esolang
Jump to navigation Jump to search

(NOTE: if you want to name a new language this, go ahead and take this page. I abandon this.) 1hals (talk) 21:55, 7 August 2024 (UTC) Category:Candidates for deletion 1hals (talk) 16:08, 9 August 2024 (UTC)

Bananaban is a compiled esolang similar to Set. A program consists of a sequence of lines containing commands. Command arguments are numbers, and numbers are written in decimal. Numbers can also be represented by their ascii codes as letters. Any line that does not start with a command is treated as a comment.

Commands

ban A B = static memory; reserve locations A through B

set A B = assignment; set value of location A to the value B

set@ A B = assignment; set location A to value at location B

set* A B... = assignment; set locations starting from A to the sequence of values B

dif A B = difference; set value of location A to the value of location A minus value of location B

dif@ A B = difference; set value of location A to the value of location A minus the value B

Memory mapped control

Every number can be read from and written to. But some locations have special meaning.

0 = program instruction pointer

1 = current output

2 = current input

3 = if set to 0, the program halts

Example Programs

Hello world (1)

set 1 H
set 1 e
set 1 l
set 1 l
set 1 o
set 1 32
set 1 w
set 1 o
set 1 r
set 1 l
set 1 d
set 1 !
set 1 10
set 3 0

Hello world (2)

set* 4 Hello 32 world! 10 0
set Z 4
set@ 3 Z
set@ 1 Z
dif Z -1
set 0 1

Print the language name

set* 3 Bananaban 10 0
set Z 3
set@ 3 Z
set@ 1 Z
dif Z -1
set 0 1

Cat program

set@ 1 2
set 0 0