- # = Number (example:
#10
) - $ = Register (exampe:
$r0
) - : = Label (example:
:label
) - " = String (example:
" Test "
) - ! = Last item of stack (example:
push !
) - ! = Second to last item of stack (example:
push !!
)
The avaliable registers are:
- r0
- r1
- r2
- r3
- r4
- r5
- r6
- r7
- r8
- r9
Example:
:main
push #30
push " Test "
sout !
nout !
Output: Test30
Example:
:main
push #30
pop $r0
nout $r0
Output: 30
Example:
:main
push #30
push #40
add
nout !
Output: 70
Example:
:main
push #30
push #40
sub
nout !
Output: 10
Example:
:main
push #10
push #10
mul
nout !
Output: 100
Example:
:main
nout #30
Output: 30
Example:
:main
sout " Hello, world! "
Output: Hello, world!
Example:
:main
cout #65
Output: A
Example:
:test
sout " Hello from the test label! "
ret
:main
jump :test
Output: Hello from the test label!
Example:
:test
sout " Hello from the test label! "
ret
:main
push #30
push #30
je :test
Output: Hello from the test label!
Example:
:test
sout " Hello from the test label! "
ret
:main
push #30
push #20
je :test
Output: (None)
Example:
:test
sout " Hello from the test label! "
ret
:main
push #30
push #30
jne :test
Output: (None)
Example:
:test
sout " Hello from the test label! "
ret
:main
push #30
push #20
jne :test
Output: Hello from the test label!
Example:
:test
sout " Hello! "
ret
sout " Hello! "
:main
jump :test
Output: Hello!
Example:
:main
jump :test
push #10
set " test "
push #20
get " test "
nout !
Output: 10