2025-01-22 13:41:35 +09:00

42 lines
835 B
Plaintext

;; CONTRACT: Test
FUNCTION id(integer) -> integer
RETURN
FUNCTION jumps() -> integer
PUSH 0
JUMP 3
NOP
JUMP 2
NOP
RETURN
NOP
JUMP 1
FUNCTION inc(integer) -> integer
INCA
INCA
RETURN
FUNCTION call(integer) -> integer
INCA
CALL "inc"
INCA
RETURN
FUNCTION tailcall(integer) -> integer
INCA
CALL_T "inc"
;; FUNCTION remote_call(integer) : integer
;; PUSH arg0
;; CALL_R remote.add_five {tuple, [integer]} integer 0 ;; typereps don't parse
;; INCA
;; RETURN
;; Test the code from the shell
;; _build/default/rel/aessembler/bin/aessembler console
;; gmb_gmfa:file("../../../../test/asm_code/test.fate", []).
;; f(Asm), f(Env), f(BC), Asm = gmfa_asm:read_file("../../../../test/asm_code/test.fate"), {Env, BC} = gmfa_asm:asm_to_bytecode(Asm, []), gmfa_asm:bytecode_to_fate_code(BC, []).