// Evaluator definitions // // File: eval.h // Author: course // Version: 1 #ifndef EVAL_H #define EVAL_H // The local variable binding environment. A list of // the form: ((name . binding) ...) where the name is a // symbol and the binding is the local binding of the // symbol: i.e., the value of the symbol as a local // variable. // extern object * environment; // Evaluate an s-expression in the current environment. // object * eval_sexpr (object * sexpr); // Apply a function object to an argument list. The // function object may be a primitive non-special // function, or a list beginning with LAMBDA, // LAMBDA-CLOSURE, or MACRO. The environment is set to // NIL, except in the case of a LAMBDA-CLOSURE where the // environment is set from the LAMBDA-CLOSURE. // // Both arguments to apply are preserved. The original // environment is saved and restored. // object * apply (object * function, object * arglist); // Take a function argument given to prim_funcall, // prim_apply, or the like and make it ready to pass to // apply; insists on being given a LAMBDA list, // primitive (non-special) function, LAMBDA_CLOSURE, or // a symbol with one of these as its global function // binding; and calls error in other cases. // // Returns the function binding of a symbol, or the // argument itself if that is not a symbol. // // Check_funarg does NO memory allocation. // object * check_funarg (object * funarg); // Return a pointer to the symbol's current binding, // giving the symbol's current environment binding if // any, and otherwise the symbol's global symbol_value // component. // object ** binding_pointer (object * sym); #endif // EVAL_H