added get_addr and jmp

This commit is contained in:
IgorCielniak
2026-02-12 17:39:05 +01:00
parent 709377a45b
commit a3c68860a7
4 changed files with 38 additions and 0 deletions

5
tests/jmp_test.expected Normal file
View File

@@ -0,0 +1,5 @@
gg
gg
gg
gg
gg

18
tests/jmp_test.sl Normal file
View File

@@ -0,0 +1,18 @@
import stdlib.sl
word main
5 # loop count
get_addr # push loop target address (next instruction)
"gg" puts
swap # bring count to top
1 - # decrement
dup 0 > if
swap # put addr on top
dup # keep a copy for next iteration
jmp
else
drop # drop count
drop # drop addr
end
end

1
tests/jmp_test.test Normal file
View File

@@ -0,0 +1 @@
python main.py tests/jmp_test.sl -o ./build/jmp_test > /dev/null && ./build/jmp_test