transcendental-lisp/eval/LispFunction.java

45 lines
1.2 KiB
Java
Raw Normal View History

2016-12-07 14:16:45 -05:00
/*
* Name: Mike Cifelli
* Course: CIS 443 - Programming Languages
* Assignment: Lisp Interpreter 1
*/
package eval;
import parser.*;
/**
* A <code>LispFunction</code> is an internal representation of a built-in
* function in the Lisp programming language.
*/
public abstract class LispFunction {
/**
* Call this Lisp function with the given list of arguments.
*
* @param argList
* the list of arguments to pass to this function (MUST BE A PROPER LIST)
* @return
* the resulting S-expression of calling this function with the specified
* arguments
* @throws RuntimeException
* Indicates that an incorrect number of arguments has been passed to this
* function or that one of the arguments is not of the expected type.
*/
public abstract SExpression call(Cons argList);
/**
* Determine if the arguments passed to this Lisp function should be
* evaluated. A subclass should override this method to return
* <code>false</code> if it does not want its arguments to be evaluated
* prior to being passed.
*
* @return
* <code>true</code>
*/
public boolean evaluateArguments() {
return true;
}
}