Transformation of Applicative Specifications into Imperative ...

Transformation of Applicative Specifications into Imperative ... Transformation of Applicative Specifications into Imperative ...

26.09.2013 Views

APPENDIX C. FORMAL SPECIFICATIONS OF TRANSFORMATIONS case te of TypeName(tn) → if tn ∈ dom trans then /∗Type of interest.∗/ 〈AccessValueOrVariableName( mk_ValueOrVariableName(tn))〉 else /∗Not type of interest.∗/ 〈〉 end, → 〈〉 end, Unknown → 〈〉 end, /∗Returns an access list of the values of types of interest written to during evaluation of a set expression.∗/ /∗ Arguments: ======= idset: the functions already evaluated se: the set expression Result: ======= AccessResult: the corresponding access result ∗/ getAccessGenSetExpr : Id-set × SetExpr × ExpType × FUNC × TRANS → AccessResult getAccessGenSetExpr(idset, se, et, func, trans) ≡ case se of RangedSetExpr(fve, sve) → getAccessGenListList( idset, 〈fve, sve〉, 〈et, et〉, func, trans), EnumeratedSetExpr(ovel) → getAccessGenOptVEL(idset, ovel, et, func, trans), ComprehendedSetExpr(ve, typlist, or) → let ar = getAccessGen(idset, ve, et, func, trans), ar ′ = getAccessGenList( idSet(ar), getVEOptRestriction(or), 266

C.1. FORMAL SPECIFICATION OF THE TRANSFORMER end, in expTypeToExpTypeList( removeBrackets( Known(TypeLiteral(BOOL))), 1), func, trans) mk_AccessResult( removeDuplets( accessList(ar) accessList(ar ′ )), idSet(ar ′ )) end /∗Returns an access list of the values of types of interest written to during evaluation of a list expression.∗/ /∗ Arguments: ======= idset: the functions already evaluated le: the list expression Result: ======= AccessResult: the corresponding access result ∗/ getAccessGenListExpr : Id-set × ListExpr × ExpType × FUNC × TRANS → AccessResult getAccessGenListExpr(idset, le, et, func, trans) ≡ case le of RangedListExpr(fve, sve) → getAccessGenListList( idset, 〈fve, sve〉, 〈et, et〉, func, trans), EnumeratedListExpr(ovel) → getAccessGenOptVEL(idset, ovel, et, func, trans), ComprehendedListExpr(ve1, b, ve2, or) → getAccessGenListList( idset, 〈ve1〉 〈ve2〉 getVEOptRestriction(or), 〈et, et, Known(TypeLiteral(BOOL))〉, func, trans) end, /∗Returns an access list of the values of types of interest written to during evaluation of a 267

APPENDIX C. FORMAL SPECIFICATIONS OF TRANSFORMATIONS<br />

case te <strong>of</strong><br />

TypeName(tn) →<br />

if tn ∈ dom trans<br />

then<br />

/∗Type <strong>of</strong> interest.∗/<br />

〈AccessValueOrVariableName(<br />

mk_ValueOrVariableName(tn))〉<br />

else<br />

/∗Not type <strong>of</strong> interest.∗/<br />

〈〉<br />

end,<br />

→ 〈〉<br />

end,<br />

Unknown → 〈〉<br />

end,<br />

/∗Returns an access list <strong>of</strong> the values <strong>of</strong> types<br />

<strong>of</strong> interest written to during evaluation <strong>of</strong> a<br />

set expression.∗/<br />

/∗<br />

Arguments:<br />

=======<br />

idset: the functions already evaluated<br />

se: the set expression<br />

Result:<br />

=======<br />

AccessResult: the corresponding access result<br />

∗/<br />

getAccessGenSetExpr :<br />

Id-set × SetExpr × ExpType × FUNC × TRANS →<br />

AccessResult<br />

getAccessGenSetExpr(idset, se, et, func, trans) ≡<br />

case se <strong>of</strong><br />

RangedSetExpr(fve, sve) →<br />

getAccessGenListList(<br />

idset, 〈fve, sve〉, 〈et, et〉, func, trans),<br />

EnumeratedSetExpr(ovel) →<br />

getAccessGenOptVEL(idset, ovel, et, func, trans),<br />

ComprehendedSetExpr(ve, typlist, or) →<br />

let<br />

ar = getAccessGen(idset, ve, et, func, trans),<br />

ar ′ =<br />

getAccessGenList(<br />

idSet(ar), getVEOptRestriction(or),<br />

266

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!