Blarb

From Esolang
Jump to navigation Jump to search

Blarb is designed to be the simplest possible (esoteric) systems programming language. Being as such, there is only one logical operator: NAND. It is an assembly-like, stack & register based language.

For a full description, see the Github repo: https://github.com/elimirks/BlarbVM

Example for creating an "add" function

; Pushes the current line to the stack
; The stack will now contain 2, 3, and the current line number

; No token are allowed after a call to a label
 
2 3 0$andi
0 0 0 0 0 0 60 % ; exit by calling syscall 60

; Bitwise AND the two arguments and push the result to the stack
#andi
   4 3 ! ; A NAND B (the two arguments)
   4 4 ! ; NAND the result with itself to bitwise NOT it

   ; Pop the stack frame and second argument.
   ; The remaining stack data will only include the return value
   ; The "2 0 ~" sets the line pointer to the return address
   ; The "2 ^" pops the return address and the second argument
   2 0 ~ 2 ^

; Run this program with "--debug" to see the result on the stack