Next: Global Variables Up: The Instructions Previous: Non-local Exits

Higher-Order Instructions

In LL, three builtins for higher-order function application exist: funcall, apply, and eval. Their corresponding LLAMA instructions funcall , apply , and eval work as follows:

  1. funcall :

  2. apply : In case of apply, there is only a minor difference to funcall: the top stack element, which must be a list, is expanded on the stack, and the length of this list minus 1 is added to the arity of the function to be called.

  3. eval: The external representation (denoted as ) of the expression which has to be evaluated is embedded in a new function definition (defun %eval() ) which is executed. Subsequently, the address of the instruction behind the eval instruction is pushed as return address on the stack and execution is continued with %eval.

    Note that for eval the compiler is used at run time instead of interpreting the expression.



Next: Global Variables Up: The Instructions Previous: Non-local Exits


Harold Boley & Michael Sintek (sintek@dfki.uni-kl.de)