|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.ksu.cis.projects.bogor.ast.ASTVisitor edu.ksu.cis.projects.bogor.ast.checker.ExpChecker
public final class ExpChecker
This class is used to deduce the type of expressions.
Method Summary | |
---|---|
static Type |
checkExp(Exp node,
boolean allowHighLevel,
boolean inSideEffectFreeContext,
Map<String,Type> bindingMap,
edu.ksu.cis.projects.bogor.ast.checker.TypeChecker ttc,
SymbolTable st,
FSMSymbolTable fsmSt)
Calculate the type of an expression. |
protected RecordType |
findLUB(String rid,
String oldRId)
|
protected Type[] |
inferExtTypeArguments(ExtSymbolTable st,
ExtExp node,
Type[] extArgTypes)
|
protected boolean |
inferType(HashMap<String,Type> map,
Type parameterType,
Type type)
|
protected boolean |
putType(HashMap<String,Type> map,
String id,
Type type)
|
protected void |
visitApplyExp(ApplyExp node)
Type checks an apply exp. |
protected void |
visitArrayAccessExp(ArrayAccessExp node)
Type checks an array access. |
protected void |
visitAtomicExp(AtomicExp node)
Type checks an atomic expression |
protected void |
visitBinaryExp(BinaryExp node)
Type checks a binary exp. |
protected void |
visitBooleanLiteral(BooleanLiteral node)
Type checks a boolean literal. |
protected void |
visitCastExp(CastExp node)
Type checks a cast exp. |
protected void |
visitConditionalExp(ConditionalExp node)
Type checks a conditional exp. |
protected void |
visitDoubleLiteral(DoubleLiteral node)
Type checks a double literal. |
protected void |
visitExtExp(ExtExp node)
Type checks an ext exp. |
protected void |
visitFieldAccessExp(FieldAccessExp node)
Type checks a field access. |
protected void |
visitFloatLiteral(FloatLiteral node)
Type checks a float literal. |
protected void |
visitIdExp(IdExp node)
Type checks an id exp. |
protected void |
visitInstanceofExp(InstanceofExp node)
Type checks an instanceof exp. |
protected void |
visitIntLiteral(IntLiteral node)
Type checks an integer literal. |
protected void |
visitInvokeExp(InvokeExp node)
Type checks an invoke exp. |
protected void |
visitKindofExp(KindofExp node)
Type checks an kindof exp. |
protected void |
visitLetExp(LetExp node)
Type checks a let exp. |
protected void |
visitLockTestExp(LockTestExp node)
Type checks a lock test. |
protected void |
visitLongLiteral(LongLiteral node)
Type checks a long literal. |
protected void |
visitNewArrayExp(NewArrayExp node)
Type checks a new array exp. |
protected void |
visitNewLockExp(NewLockExp node)
Type checks a new record exp. |
protected void |
visitNewRecordExp(NewRecordExp node)
Type checks a new record exp. |
protected void |
visitNullLiteral(NullLiteral node)
Type checks a null literal. |
protected void |
visitParenExp(ParenExp node)
Type checks a parenthesis exp. |
protected void |
visitStartThreadExp(StartThreadExp node)
Type checks a start thread exp. |
protected void |
visitStringLiteral(StringLiteral node)
Type checks a string literal. |
protected void |
visitThreadTestExp(ThreadTestExp node)
Type checks a thread test exp. |
protected void |
visitUnaryExp(UnaryExp node)
Type checks a unary node. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Type checkExp(Exp node, boolean allowHighLevel, boolean inSideEffectFreeContext, Map<String,Type> bindingMap, edu.ksu.cis.projects.bogor.ast.checker.TypeChecker ttc, SymbolTable st, FSMSymbolTable fsmSt)
node
- The expression whose type should be foundallowHighLevel
- Switch enabling nested function application and other
high-level BIR language featuresinSideEffectFreeContext
- tracks whether node
is a sub-node of some guard
expressionbindingMap
- The set of bound variable ID's (e.g., from "let" constructs)
mapped to their typesttc
- Utility to convert AST type nodes into interal bogor typesst
- System-wide symbol tablefsmSt
- Optional FSM-specific symbol table; should be non-null if
node
lives inside an FSM.
null
if an errors occurs. If the return value is non-null, then
it is also set as the Exp.TYPE
property on
node
protected void visitApplyExp(ApplyExp node)
Generates an error if:
visitApplyExp
in class ASTVisitor
node
- The array access. Non-null.protected void visitArrayAccessExp(ArrayAccessExp node)
Generates an error if:
visitArrayAccessExp
in class ASTVisitor
node
- The array access. Non-null.protected void visitAtomicExp(AtomicExp node)
Generates an error if:
visitAtomicExp
in class ASTVisitor
node
- The atomic exp. Non-null.protected void visitBinaryExp(BinaryExp node)
Generates an error if:
visitBinaryExp
in class ASTVisitor
node
- The binary exp. Non-null.protected void visitBooleanLiteral(BooleanLiteral node)
visitBooleanLiteral
in class ASTVisitor
node
- The boolean literal. Non-null.protected void visitCastExp(CastExp node)
Generates an error if:
visitCastExp
in class ASTVisitor
node
- The cast exp. Non-null.protected void visitConditionalExp(ConditionalExp node)
Generates an error if:
visitConditionalExp
in class ASTVisitor
node
- The conditional exp. Non-null.protected void visitDoubleLiteral(DoubleLiteral node)
visitDoubleLiteral
in class ASTVisitor
node
- The double literal. Non-null.protected void visitExtExp(ExtExp node)
visitExtExp
in class ASTVisitor
node
- The ext exp. Non-null.protected void visitFieldAccessExp(FieldAccessExp node)
Generates an error if:
visitFieldAccessExp
in class ASTVisitor
node
- The field access. Non-null.protected void visitFloatLiteral(FloatLiteral node)
visitFloatLiteral
in class ASTVisitor
node
- The float literal. Non-null.protected void visitIdExp(IdExp node)
Generates an error if:
visitIdExp
in class ASTVisitor
node
- The id exp. Non-null.protected void visitInstanceofExp(InstanceofExp node)
Generates an error if:
visitInstanceofExp
in class ASTVisitor
node
- The instanceof exp. Non-null.protected void visitIntLiteral(IntLiteral node)
visitIntLiteral
in class ASTVisitor
node
- The integer literal. Non-null.protected void visitInvokeExp(InvokeExp node)
Generates an error if:
visitInvokeExp
in class ASTVisitor
node
- The invoke exp. Non-null.protected void visitKindofExp(KindofExp node)
Generates an error if:
visitKindofExp
in class ASTVisitor
node
- The kindof exp. Non-null.protected void visitLetExp(LetExp node)
Generates an error if:
visitLetExp
in class ASTVisitor
node
- The invoke transformation. Non-null.protected void visitLockTestExp(LockTestExp node)
Generates an error if:
visitLockTestExp
in class ASTVisitor
node
- The lock test. Non-null.protected void visitLongLiteral(LongLiteral node)
visitLongLiteral
in class ASTVisitor
node
- The long literal. Non-null.protected void visitNewArrayExp(NewArrayExp node)
Generates an error if:
visitNewArrayExp
in class ASTVisitor
node
- The new array exp. Non-null.protected void visitNewLockExp(NewLockExp node)
visitNewLockExp
in class ASTVisitor
node
- The new lock exp. Non-null.protected void visitNewRecordExp(NewRecordExp node)
Generates an error if:
visitNewRecordExp
in class ASTVisitor
node
- The new record exp. Non-null.protected void visitNullLiteral(NullLiteral node)
visitNullLiteral
in class ASTVisitor
node
- The null literal. Non-null.protected void visitParenExp(ParenExp node)
visitParenExp
in class ASTVisitor
node
- The parenthesis exp. Non-null.protected void visitStartThreadExp(StartThreadExp node)
Generates an error if:
visitStartThreadExp
in class ASTVisitor
node
- The start thread exp.protected void visitStringLiteral(StringLiteral node)
visitStringLiteral
in class ASTVisitor
node
- The string literal. Non-null.protected void visitThreadTestExp(ThreadTestExp node)
Generates an error if:
visitThreadTestExp
in class ASTVisitor
node
- The thread test exp. Non-null.protected void visitUnaryExp(UnaryExp node)
Generates an error if:
visitUnaryExp
in class ASTVisitor
node
- The unary node. Non-null.protected Type[] inferExtTypeArguments(ExtSymbolTable st, ExtExp node, Type[] extArgTypes)
protected boolean inferType(HashMap<String,Type> map, Type parameterType, Type type)
protected boolean putType(HashMap<String,Type> map, String id, Type type)
protected RecordType findLUB(String rid, String oldRId)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |