
Java Formal Semantics
|
set makeAttributeList is --SC: Determines the attribute list correponding to a given type (useful for --SC: an object creation). -- --JC: |- Class name of the new instance --JC: -> Initialized Attribute list judgement |- OptTypeName -> Pairs; DeclarationObject_InProgramClasses: getClassDeclaration( ClName1 -> ClDec ) & getLocalAttributeList( |- ClDec -> LocAttrL ) & getDirectAncestor( |- ClName1 -> ClName2 ) & makeInheritedAttributeList( LocAttrL |- ClName2 -> AttrL ) -------------------------------- |- ClName1 -> AttrL ; DeclarationObject_inAPI: getAPIObjectAttributes( |- ClName -> AttrL ) -------------------------------- |- ClName -> AttrL ; end makeAttributeList; |
ComplexAssignValueToASimpleVariable:
--RC: Assigns a value to a variable (parameter or local variable).
--
--CS: var1 = 10;
assign(
ObjL1, ClVarL1, Env1, ObjId |- Ident, TVValue -> ObjL1_1, ClVarL1_1, Env1_1 )
--------------------------------
ObjL1, ClVarL1, Env1, _, ObjId, _ |-
semAssign(empty(), Ident, assignment(), TVValue) -> ObjL1_1, ClVarL1_1, Env1_1, TVValue, insts[], runnable() ;
|
ComplexAssignExpressionToASimpleVariable:
--RC: Evaluates the right member of the assignment before assigning the
--RC: variable.
--
--CS: var1 = 25 + var2;
evaluateExpression(
ObjL, ClVarL, Env, OThId, ObjId, Mode |-
Expr -> ObjL_1, ClVarL_1, Env_1, Expr_1, InstL, ThStatus )
--------------------------------
ObjL, ClVarL, Env, OThId, ObjId, Mode |-
semAssign(empty(), Ident, AOp, Expr) ->
ObjL_1, ClVarL_1, Env_1, semAssign(empty(), Ident, AOp, Expr_1), InstL, ThStatus ;
|