We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

BrainASM

From Esolang
Jump to navigation Jump to search
Not to be confused with Brainasm
BrainASM(BASM)
Designed by User:Mishyakovskiy
Appeared in 2026
Memory system Cell-based
Computational class Unknown
Reference implementation Brainfuck
Influenced by Brainfuck, Assembler

BrainASM is an esoteric interpreted language, written in Lua and created by Mishyakovskiy

Language overview

The language contains 10 cells, controlled by pointer(1-10). It moves between them and commits changes to variable it points. From the start, all of them are '0' and pointer starts from 1. Every instruction in this language should be written from new line, otherwise it brings unexpected behavior and wrong calculations.

In graphic, it looks like this:

0  0  0  0  0  0  0  0  0  0
v1 v2 v3 v4 v5 v6 v7 v8 v9 v10
^
|
p

Etymology

BrainASM is a combination of two languages' names: Brainfuck and Assembler due to similarity of these both languages in BrainASM.

Instructions and functions

The current list of instructions in BrainASM is:

Instruction Description
p+ Moves pointer forward by adding 1.
p- Moves pointer backward by subtracting 1.
: (number) Sets current variable to number value.
; (string) Sets current variable to string.
# (destination) Copies current variable's value to destination variable.
@ Commentary, interpreter ignores it.
> (source) Gets source variable's value. Should be written along with some instruction in one line.
! Halts execution
fc Special instruction, stands for "function call". Once ran, it calls a function from function table. Uses first variable as position of function(starting from 1), and next three variables as arguments for called function (more information in "Function calls").
ib (number) If-statement. Stands for "if bigger than...". Returns true if current variable is bigger than number, or else returns false.
il (number) If-statement. Stands for "if less than...". Returns true if current variable is less than number, or else returns false.
iq (number) If-statement. Stands for "if equals to...". Returns true if current variable equals to number, or else returns false.
stre (string) If-statement. Stands for "if string equals to...". Returns true if current variable equals to string, or else returns false.
nstre (string) If-statement. Stands for "if string doesn't equals to...". Returns true if current variable doesn't equals to string, or else returns false.
ei Stands for "end if". Ends if-statement's body.

Function calls

Function calls are special functions, stored in func_calls table in interpreter source code. Their main feature is to support much more complex instructions and be flexible.

For arguments, they use 2, 3 and 4 variables.

Currently, there is three main function calls:

Number Function Arguments Description
1 print() (var) Prints var's value.
2 input() nil Takes digit input from user and writes to variable 5.
3 strin() nil Takes string input from user and writes to variable 5.

Examples

Hello world!

: 1
p+
: 3
p+
; 'Hello World!
fc

A+B problem

: 2
fc
p+
: > 5
# 7
fc
: > 5
# 8
: 7
p-
: 1
p+
p+
p+
p+
p+
p+
+ > 8
fc

Calculator

@ Calculator

: 2
p+
p+
p+
p+
@ 5

fc
# 7
fc
# 8
: 3
# 1
fc
# 9
: 1
# 1
: 7
# 2
p+
p+
p+
p+

stre '+
p-
p-
+ > 8
fc
!
ei
stre '-
p-
p-
- > 8
fc
!
ei
stre '*
p-
p-
* > 8
fc
!
ei
stre '/
p-
p-
/ > 8
fc
!
ei

See also

Brainfuck

External resources

GitHub source code