| java.lang.Object xtc.typical.Analyzer
All known Subclasses: xtc.lang.TypedLambdaAnalyzer, xtc.lang.c.CAnalyzer, xtc.typical.TypicalAnalyzer,
Analyzer | abstract public class Analyzer (Code) | | The base class of all Typical-generated type checkers.
author: Laune Harris, Anh Le version: $Revision: 1.145 $ |
Inner Class :public static interface Match extends Function.F0<T> | |
Inner Class :public static interface Require extends Function.F0<T> | |
Inner Class :public static interface Let extends Function.F0<T> | |
Inner Class :public static interface Guard extends Function.F0<T> | |
Field Summary | |
final protected String | ENTERSCOPE The property to check if enter a scope. | final protected String | EXITSCOPE The property of check if exit a scope. | final protected String | MAGICNUMBER The property to store the times of not entering a new scope because
the new scope is also the current scope. | protected Function.F1<?, Node> | analyzer The analyzer. | final protected Function.F1<Node, NodeMatch> | ancestor The ancestor function. | final protected Function.F3<Void, Node, Object, Function.F1<?, Node>> | define3 A Typical function to define a node, without error messages. | final protected Function.F5<Void, Node, Object, String, String, Function.F1<?, Node>> | define5 A Typical function to define a node, with an error message. | final protected Function.F1<String, String> | freshName The Typical function to get a new name. | final protected SymbolTable | gamma The symbol table. | protected Hashtable<Object, Object> | hashTable | final protected Function.F2<Boolean, Node, Function.F1<?, Node>> | isDefined | final protected Function.F2<Boolean, Node, Function.F1<?, Node>> | isDefinedLocally | final protected Function.F3<Void, String, String, Object> | load The Typical load function to load predefined values and data types. | final protected Function.F2<Object, Node, Function.F1<?, Node>> | lookup2 A Typical function to lookup a node, without error messages. | final protected Function.F4<Object, Node, String, String, Function.F1<?, Node>> | lookup4 A Typical function to lookup a node, with an error message. | final protected Function.F2<Object, Node, Function.F1<?, Node>> | lookupLocally2 A Typical function to lookup a node locally, without error messages. | final protected Function.F4<Object, Node, String, String, Function.F1<?, Node>> | lookupLocally4 A Typical function to lookup a node locally, with an error message. | final protected ArrayList<Node> | matching_nodes The visited node path. | final protected Function.F1<Boolean, Object> | notBottom The Typical function to check if a value if bottom. | final protected Function.F1<Node, NodeMatch> | parent The parent function. | final protected ArrayList<String> | processScopeNodes The list of names of the nodes that trigger scope changes. | final protected Function.F3<Void, Node, Object, Function.F1<?, Node>> | redefine A Typical function to redefine a node. | protected Node | root The tree root. | final protected Runtime | runtime The runtime. | final protected Function.F1<Boolean, String> | show_symbols The Typical function to print a symbol. |
Constructor Summary | |
public | Analyzer(Runtime runt) Create a new TypeChecker base. |
Method Summary | |
final public static T | cast(Object arg) Cast an object to type T.
Parameters: arg - The object to cast. | protected void | checkEnterScope(Node n) Check a node and enter a scope. | protected void | checkExitScope(Node n) Check a node and exit scope. | final protected static void | discard(Object o) Ignore the specified value. | public static Boolean | equal(Object o1, Object o2) Test for equality between two objects.
Parameters: o1 - The first object. Parameters: o2 - The second object. | protected Object | error(String s, Node n) Print a error message.
Parameters: s - The msg. Parameters: n - The location. | public Node | getASTRoot() Returns the (possibly annotated and modified) AST root. | abstract protected void | getScopeNodes() Get the names of the nodes that trigger scope changes. | protected static Boolean | not_equal(Object o1, Object o2) Test for equality between two objects.
Parameters: o1 - The first object. Parameters: o2 - The second object. | protected void | printAST(Node n) Utility function to print a nicely formatted ast for debugging. | protected void | processScope(Node n, Function.F1<?, Node> getScope) Process scope. | public SymbolTable | run(Node n) Run this typechecker on the tree rooted at n.
Parameters: n - The tree root. | protected void | showMessage(String tag, String msg, Object o) Print a error message. | final public static String | toString(Object o) Convert the specified object to a string.
Parameters: o - The object. | protected Object | warning(String s, Node n) Print a warning message.
Parameters: s - The msg. Parameters: n - The location. |
ENTERSCOPE | final protected String ENTERSCOPE(Code) | | The property to check if enter a scope.
|
EXITSCOPE | final protected String EXITSCOPE(Code) | | The property of check if exit a scope.
|
MAGICNUMBER | final protected String MAGICNUMBER(Code) | | The property to store the times of not entering a new scope because
the new scope is also the current scope.
|
notBottom | final protected Function.F1<Boolean, Object> notBottom(Code) | | The Typical function to check if a value if bottom.
Return true if not bottom, otherwise bottom
(It will be removed once guard is done)
|
processScopeNodes | final protected ArrayList<String> processScopeNodes(Code) | | The list of names of the nodes that trigger scope changes.
|
Analyzer | public Analyzer(Runtime runt)(Code) | | Create a new TypeChecker base.
Parameters: runt - The runtime. |
cast | final public static T cast(Object arg)(Code) | | Cast an object to type T.
Parameters: arg - The object to cast. The object cast to T |
checkEnterScope | protected void checkEnterScope(Node n)(Code) | | Check a node and enter a scope.
Parameters: n - The node to check. |
checkExitScope | protected void checkExitScope(Node n)(Code) | | Check a node and exit scope.
Parameters: n - The node to check. |
discard | final protected static void discard(Object o)(Code) | | Ignore the specified value.
Parameters: o - The value to ignore. |
equal | public static Boolean equal(Object o1, Object o2)(Code) | | Test for equality between two objects.
Parameters: o1 - The first object. Parameters: o2 - The second object. true if both are equal, false otherwise. |
error | protected Object error(String s, Node n)(Code) | | Print a error message.
Parameters: s - The msg. Parameters: n - The location. null |
getASTRoot | public Node getASTRoot()(Code) | | Returns the (possibly annotated and modified) AST root.
The root of the ast. |
getScopeNodes | abstract protected void getScopeNodes()(Code) | | Get the names of the nodes that trigger scope changes.
|
not_equal | protected static Boolean not_equal(Object o1, Object o2)(Code) | | Test for equality between two objects.
Parameters: o1 - The first object. Parameters: o2 - The second object. true if the o1 and o2 not equal, false otherwise. |
printAST | protected void printAST(Node n)(Code) | | Utility function to print a nicely formatted ast for debugging.
Parameters: n - The ast root. |
processScope | protected void processScope(Node n, Function.F1<?, Node> getScope)(Code) | | Process scope.
Parameters: n - The node to process. Parameters: getScope - The generated getScope function. |
run | public SymbolTable run(Node n)(Code) | | Run this typechecker on the tree rooted at n.
Parameters: n - The tree root. The Symbol table of the ast. |
showMessage | protected void showMessage(String tag, String msg, Object o)(Code) | | Print a error message.
Parameters: tag - The message class. Parameters: msg - The message. Parameters: o - The node generating the message. |
toString | final public static String toString(Object o)(Code) | | Convert the specified object to a string.
Parameters: o - The object. The corresponding string. |
warning | protected Object warning(String s, Node n)(Code) | | Print a warning message.
Parameters: s - The msg. Parameters: n - The location. null |
|
|