It is simple implementation of Virtual Machine with its own asm language and Von Neumann architecture. It has assembler, cpu and disassembler.
!var int 42
create int variable with namevar
and value42
.lbl
defines label, related to the code above%
prefix means register!
prefix means variablein, out <smth>
read from / write to stdin / stdoutgo <smth>
jump to specified labelif<, if>, if= <a> <b>
comparesa
andb
, executes code right after compare if true, otherwise jumps tofi
ret
return to the callerpush, pop <smth>
push or pop value to or from stackmov <dest> <src>
movesrc
todest
add, sub <dest> <src>
add or subsrc
todest
./main <path-to-file>
or go main <path-to-file>
, where file is written in gasm
language and has .gasm
extension.
Or you can run demo:
./main
or go main
It will execute asm_data/fibonacci.gasm
file, which is a recursive version of fibonacci calculation.
main
will generate binary file, execute it, and also disassemble it back.