2019-02-18 18:09:00 +01:00

45 lines
843 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
INCA
RETURN
FUNCTION remote_tailcall(integer) : integer
PUSH arg0
CALL_TR remote add_five
;; Test the code from the shell
;; _build/default/rel/aessembler/bin/aessembler console
;; aeb_aefa:file("../../../../test/asm_code/test.fate", []).
;; f(Asm), f(Env), f(BC), Asm = aefa_asm:read_file("../../../../test/asm_code/test.fate"), {Env, BC} = aefa_asm:asm_to_bytecode(Asm, []), aefa_asm:bytecode_to_fate_code(BC, []).