|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--edu.mit.ai.psg.jeva.EvalMethods
Centralized static methods for evaluating nodes while catching exceptions. Top level: EvalMethods.evaluate(node, env) verifies types before evaluating.
To evaluate subnodes, nodes call EvalMethods.eval(node, env) rather than calling the subnode eval method directly, so that when an error is thrown, this will wrap error in an EvaluatingError which identifies what node was being evaluated at the time. Similarly, nodes call EvalMethods.getType(expressionNode, env) and EvalMethods.verifyTypes(statementNode, env) rather than calling subnode methods directly so that when an error is thrown, this will wrap the error in a VerifyingError identifying node and env.
Evaluation may also throw other exceptions.
evalHook before and after each construct is evaluated.
See edu.mit.ai.psg.jeva.examples for examples of using
evalHook for tracing.
VerifyingException,
IllegalTypeException,
IllegalNameException,
IllegalConstructException,
AbruptCompletionException,
ThrowException,
ReturnException,
BreakException,
ContinueException,
VerifyingError,
EvaluatingError| Inner Class Summary | |
static class |
EvalMethods.AbruptData
EvalHook data with AbruptCompletionException
(includes ReturnException, ThrowException,
BreakException, ContinueException) |
static class |
EvalMethods.EvalHookData
EvalHook is passed instance of EvalHookData: . |
static interface |
EvalMethods.EvalHookError
|
static class |
EvalMethods.EvalHookPostData
|
static class |
EvalMethods.EvalHookPreData
|
static class |
EvalMethods.PreEvalData
EvalHook data prior to evaluating expression or statement |
static class |
EvalMethods.PreEvalToStoreData
EvalHook data prior to evaluating expression to store target for assignment |
static class |
EvalMethods.ResultData
EvalHook data with expression result value |
static class |
EvalMethods.ResultEnvData
EvalHook data with statement result environment |
static class |
EvalMethods.ResultStoreData
EvalHook data with expression store target for assignment |
| Field Summary | |
static IEnv |
defaultEnv
|
static IJevaVisitor |
evalHook
if EvalHook is non null, it is called before and after each node is evaluated, with the appropriate EvalMethods#EvalHookData. |
| Method Summary | |
static Object |
eval(IExpressionNode node)
|
static Object |
eval(IExpressionNode enode,
IEnv env)
|
static IEnv |
eval(IStatementNode node)
|
static IEnv |
eval(IStatementNode snode,
IEnv env)
|
static void |
eval(JNCompilationUnit node,
String[] arguments)
Finds public class of previously verified compilation unit, runs public static void main(String[]) method of this public class if one exists. |
static void |
eval(JNCompilationUnit node,
String[] arguments,
IEnv env)
Calls "public static void main(String[])" method of public class in compilation unit. |
static IStore |
evalToStore(IExpressionStoreNode node)
|
static IStore |
evalToStore(IExpressionStoreNode esnode,
IEnv env)
|
static Object |
evaluate(IExpressionNode node)
verify types then evaluate node with default env |
static Object |
evaluate(IExpressionNode node,
IEnv env)
verify types then evaluate node with given env |
static IEnv |
evaluate(IStatementNode node)
verify types then evaluate node with default env |
static IEnv |
evaluate(IStatementNode node,
IEnv env)
verify types then evaluate node with given env |
static void |
evaluate(JNCompilationUnit node,
String[] arguments)
verify types with default env, then find class with public static void main(String[]) method and call it with arguments. |
static void |
evaluate(JNCompilationUnit node,
String[] arguments,
IEnv env)
verify types with env, then find public class with public static void main(String[]) method and call it with arguments. |
static IClass |
getType(IExpressionNode node)
|
static IClass |
getType(IExpressionNode node,
IEnv env)
|
static boolean |
isConstant(IExpressionNode node)
|
static boolean |
isConstant(IExpressionNode node,
IEnv env)
|
static IEnv |
verifyTypes(IStatementNode node)
|
static IEnv |
verifyTypes(IStatementNode node,
IEnv env)
|
static IEnv |
verifyTypes(JNCompilationUnit node)
|
static IEnv |
verifyTypes(JNCompilationUnit node,
IEnv env)
Scans compilation unit for class declarations, computes type signatures of methods, and verifies types in fields and methods. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public static IEnv defaultEnv
public static IJevaVisitor evalHook
EvalMethods#EvalHookData.
See edu.mit.ai.psg.jeva.examples for examples using
evalHook for tracing.| Method Detail |
public static Object evaluate(IExpressionNode node)
throws VerifyingException,
ThrowException
public static IEnv evaluate(IStatementNode node)
throws VerifyingException,
AbruptCompletionException
public static void evaluate(JNCompilationUnit node,
String[] arguments)
throws VerifyingException,
ClassNotFoundException,
ThrowException
public static Object evaluate(IExpressionNode node,
IEnv env)
throws VerifyingException,
ThrowException
public static IEnv evaluate(IStatementNode node,
IEnv env)
throws VerifyingException,
AbruptCompletionException
public static void evaluate(JNCompilationUnit node,
String[] arguments,
IEnv env)
throws VerifyingException,
ClassNotFoundException,
ThrowException
public static IClass getType(IExpressionNode node)
throws VerifyingException
public static boolean isConstant(IExpressionNode node)
throws VerifyingException
public static IEnv verifyTypes(IStatementNode node)
throws VerifyingException
public static IEnv verifyTypes(JNCompilationUnit node)
throws VerifyingException
public static Object eval(IExpressionNode node)
throws ThrowException
node - previously verified expression
public static IEnv eval(IStatementNode node)
throws AbruptCompletionException
node - previously verified statement
public static void eval(JNCompilationUnit node,
String[] arguments)
throws ClassNotFoundException,
ThrowException
node - previously verified compilation unit
public static IStore evalToStore(IExpressionStoreNode node)
throws ThrowException
node - previously verified storable expression
public static IClass getType(IExpressionNode node,
IEnv env)
throws VerifyingException
public static boolean isConstant(IExpressionNode node,
IEnv env)
throws VerifyingException
public static IEnv verifyTypes(IStatementNode node,
IEnv env)
throws VerifyingException
public static IEnv verifyTypes(JNCompilationUnit node,
IEnv env)
throws VerifyingException
public static Object eval(IExpressionNode enode,
IEnv env)
throws ThrowException
public static IStore evalToStore(IExpressionStoreNode esnode,
IEnv env)
throws ThrowException
public static IEnv eval(IStatementNode snode,
IEnv env)
throws AbruptCompletionException
public static void eval(JNCompilationUnit node,
String[] arguments,
IEnv env)
throws ThrowException,
ClassNotFoundException
|
Copyright (c) 1996-1999 Massachusetts Institute of Technology Feedback: jeva-bugs@ai.mit.edu |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||