BIITI

From Esolang
Jump to navigation Jump to search
BIITI
Designed by User:DolphyWind
Appeared in 2024
Memory system Stack-based
Computational class Turing complete
Major implementations Implementation
Influenced by 8086 Assembly, Forth
File extension(s) .biiti

BIITI (Beauty Is In The Implementation) is an esoteric programming language created by DolphyWind. It is inspired by 8086 assembly and Forth. A typical BIITI program is a list of commands separated by the \n character, that gets executed on the BIITI virtual machine.

BIITI Virtual Machine

BIITI virtual machine consists of a stack and three registers: IP, ACC and CMP. The IP register stores the position of the current instruction, CMP register stores the last comparison state and can take 4 different values, namely Less, Equal, Greater and NoCmp (has the value NoCmp by default). The ACC register holds one arbitrary variable and its value can be retrieved and modified by the program. Stack holds arbitrary many variables in FILO (First In Last Out) fashion. A variable can be either string, integer or floating point number. Stack starts off empty and the ACC has the default value of 0 (integer).

Commands

BIITI has 21 commands. But they don't do what you think they would do.

BIITI Commands
Command Action
MOV [variable] Pushes the given variable on top of the stack
JNE Pops the variable on top of the stack
JL Pops two variables from the stack and pushes their sum. Adding two strings concatenates them. Addition and other binary operations are done in the style of Forth, precisely in the style of <second> <operation> <first>
JG Pops two variables from the stack and pushes their difference
JLE Pops two variables from the stack and pushes their product
CMP Pops two variables from the stack and pushes their ratio
MUL Pops two variables and compares them, updates the CMP register accordingly
SUB [line] Jumps to the given line
JGE Skips the next line if the CMP register has the value Equal
PRINT Skips the next line if the CMP register has the value Less or Greater
RTR Skips the next line if the CMP register has the value Greater
POP Skips the next line if the CMP register has the value Greater or Equal
DUP Skips the next line if the CMP register has the value Less
PUSH Skips the next line if the CMP register has the value Less or Equal
JMP Pops the variable on top of the stack and moves it to the ACC register
DIV Pushes the variable on the ACC register on top of the stack without modifying the ACC register.
JE Pops the variable on top of the stack and prints it
ADD Pops the variable on top of the stack and pushes it back twice
ROT Reads a variable from the user and pushes it on top of the stack
INDEX Rotates the first three variables on the stack. Precisely, pushes them back in order of first, third and second
READ Pops a string and an integer, pushes the character corresponding to the index back to the stack.

Implementation

An implementation of BIITI can be found here.

Example Programs

Here are some example programs written in BIITI

Hello World

MOV "Hello World!\n"
JE

Truth-Machine

ROT
ADD
JE
ADD
MOV 1
MUL
PRINT
SUB 2

Counter

ROT
JMP
MOV 0

ADD
JE
MOV "\n"
JE
MOV 1
JL
ADD
DIV
MUL
RTR
SUB 4