next up previous contents
Next: Language constructs Up: The new language Previous: High-level opcodes   Contents

Function calling

Perhaps the functional-language heritage shows itself the most in the way we do function (or ``subroutine'') calling and argument / return-value passing.

A call opcode is implemented for subroutine or ``function'' calling. It takes three arguments, a return register, the name of the function to call, and the argument for that function.

Functions that need more than one argument passed to them, can get this by having the one argument that can be passed to be a tuple. Likewise with the return values.

An example that uses the call opcode is shown in the next section. It is the recursive factorial calculator.