|
|||||||||
| 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.
setEvalHook(edu.mit.ai.psg.jeva.IJevaVisitor)) before each
construct is evaluated and after construct is evaluated.
Nodes call evalHook after subexpressions are 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.BodyData
EvalHook data used for method, constructor, and synchrhronized blocks just after entering and just before exitting body |
static class |
EvalMethods.EnteredBodyData
EvalHook data used for method, constructor, and synchrhronized blocks just after entering body. |
static class |
EvalMethods.EvalHookData
EvalHook is passed instance of EvalHookData: |
static interface |
EvalMethods.EvalHookError
|
static class |
EvalMethods.EvalHookPostData
EvalHook data, all cases after evaluating |
static class |
EvalMethods.EvalHookPreData
EvalHook data, all cases prior to evaluating |
static class |
EvalMethods.ExittingBodyAbruptlyData
EvalHook data used for method, constructor, and synchrhronized blocks just before exitting body. |
static class |
EvalMethods.ExittingBodyData
EvalHook data used for method, constructor, and synchrhronized blocks just before exitting body. |
static class |
EvalMethods.PreApplyData
EvalHook data after subexpression values have been evaluated, before node is evaluated |
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
|
| 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 IJevaVisitor |
getEvalHook(IJevaVisitor hook)
|
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 void |
setEvalHook(IJevaVisitor hook)
if evalHook is non null, it is called before and after each node is evaluated, with the appropriate EvalMethods.EvalHookData. |
static Error |
shouldNotHappen(String explain)
prints stack trace of thread on System.err, returns new Error |
static Error |
shouldNotHappen(String explain,
Throwable e)
prints stack trace of e on System.err, returns new Error |
static Error |
shouldNotHappen(Throwable e)
prints stack trace of e on System.err, returns new Error |
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
| 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
public static IJevaVisitor getEvalHook(IJevaVisitor hook)
public static void setEvalHook(IJevaVisitor hook)
EvalMethods.EvalHookData.
See edu.mit.ai.psg.jeva.examples for examples using
evalHook for tracing.
public static Error shouldNotHappen(String explain,
Throwable e)
public static Error shouldNotHappen(Throwable e)
public static Error shouldNotHappen(String explain)
|
Copyright (c) 1996-1999 Massachusetts Institute of Technology Feedback: jeva-feedback@ai.mit.edu |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||