FANDOM


A VM instruction that changes control flow to another instruction, allowing control flow to return back to the instruction immediately following the call when a ret instruction is encountered.

A call instruction should always be balanced with a corresponding ret (return) instruction, otherwise the call stack for your hakk may overflow or underflow, causing the hakk to crash.

Call instructions can be nested, and recursive patterns are supported.

Call instructions may also use instruction block names as call targets.

Usage Edit

call: {label}

hakkML Example Edit

name: call_example
blocks:
  core:
  entry: {name: 'main', loc: [0,1]}
code:
  main:
    - rem: instruct VM to call a label
    - call: go_somewhere
    - out: "I am here second."
    - exit: 0
    - lbl: go_somewhere
    - out: "I am here first."
    - rem: This 'ret' instruction will return to the instruction
    - rem: after the most recent call instruction was made.
    - ret: