1.5 The Abstract Refal Machine The Refal machine is an abstract device which executes Refal programs. It has two potentially infinite information storages: the programfieldand the viewfield. The program field contains a Refal program which is loaded into the machine before the run and does not change during the run. The view field contains an expression without free variables; we refer to such expressions as ground expressions. The view field (i.e., the expression in the view field) changes in time as the machine works. The Refal machine works by steps. Each step is executed as follows. If the expression in the
view field includes no evaluation brackets (we shall refer to such expressions as passive), the Refal machine comes to a normal stop. Otherwise it picks up one of the sub-expressions of the form < F
The primary sub-expression < F To compute the value of some function Fwith the argument The order of computation of nested function calls used in Refal is known as applicative or the inside-out order. Before starting to compute any function call we complete the evaluation of all function calls in the argument. In addition to functions defined in Refal by sentences, there are a few functions which need not (and in many cases cannot) be defined in Refal but can still be used, because they are builtin into the system. Input-output functions and the functions executing arithmetic operations, among others, belong to this category. The implementation of the Refal machine on the computer is different from the abstract Refal machine in that before looking for the definition of a function in the program field, the system checks whether the function's name is in the list of available built-in functions. If it is there, the corresponding subprogram is activated which performs the required operations and replaces the function call in the view field by its computed value. |