|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.hccp.lisp.Interpreter
The interpreter takes a java.util.List of Java objects, usually generated from a text file or stream by
a Parserand "compiles" them into evaluable Sexp expressions.
It then the evaluates the expressions and returns an ordered collection of the resulting
objects. For instance, if the following Lisp expressions are passed to the interpreter (by
file reference or by input stream):
(= 5 5)
(IF
(= 4 2)
(* 3 4)
(+ 5 2)
)
one would expect to get back a list containing, in order, a Boolean.TRUE and
a Double with the value 7.0.
Parser| Constructor Summary | |
Interpreter()
|
|
Interpreter(java.util.Map env)
|
|
| Method Summary | |
org.hccp.lisp.Sexp |
compile(java.util.List l,
java.util.Iterator itr)
|
org.hccp.lisp.Sexp |
compile(java.lang.Object o,
java.util.Iterator itr)
the "compile" methods convert Strings, Doubles, and Lists to their Sexp equivalents. |
org.hccp.lisp.Sexp |
createLiteral(java.lang.Object o)
|
static void |
display(java.util.List l)
Prints out a list of lists. |
java.util.List |
interpret(java.util.List list)
|
boolean |
isDefun(java.util.List l)
Checks to see if list starts with "DEFUN" |
boolean |
isFunction(java.util.List list)
Determines if List is a function. |
static void |
main(java.lang.String[] args)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Interpreter()
public Interpreter(java.util.Map env)
| Method Detail |
public static void main(java.lang.String[] args)
public java.util.List interpret(java.util.List list)
throws IllegalArgumentException
list - a collection of objects that are reducible to some implementation of Sexp.
Sexp objects.
IllegalArgumentException - thrown if the Interpreter cannot resolve argument list into
Sexp objects.
public org.hccp.lisp.Sexp compile(java.lang.Object o,
java.util.Iterator itr)
throws IllegalArgumentException
o - object to convert to Sexp
IllegalArgumentException
public org.hccp.lisp.Sexp compile(java.util.List l,
java.util.Iterator itr)
throws IllegalArgumentException
l - list to convert to Sexp
IllegalArgumentExceptionpublic boolean isFunction(java.util.List list)
List is a function.
list -
public boolean isDefun(java.util.List l)
l -
public static void display(java.util.List l)
l - public org.hccp.lisp.Sexp createLiteral(java.lang.Object o)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||