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

C.1. FORMAL SPECIFICATION OF THE TRANSFORMER<br />

end,<br />

in<br />

expTypeToExpTypeList(<br />

removeBrackets(<br />

Known(TypeLiteral(BOOL))), 1),<br />

func, trans)<br />

mk_AccessResult(<br />

removeDuplets(<br />

accessList(ar) accessList(ar ′ )),<br />

idSet(ar ′ ))<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 />

list expression.∗/<br />

/∗<br />

Arguments:<br />

=======<br />

idset: the functions already evaluated<br />

le: the list expression<br />

Result:<br />

=======<br />

AccessResult: the corresponding access result<br />

∗/<br />

getAccessGenListExpr :<br />

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

AccessResult<br />

getAccessGenListExpr(idset, le, et, func, trans) ≡<br />

case le <strong>of</strong><br />

RangedListExpr(fve, sve) →<br />

getAccessGenListList(<br />

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

EnumeratedListExpr(ovel) →<br />

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

ComprehendedListExpr(ve1, b, ve2, or) →<br />

getAccessGenListList(<br />

idset,<br />

〈ve1〉 〈ve2〉 getVEOptRestriction(or),<br />

〈et, et, Known(TypeLiteral(BOOL))〉, func,<br />

trans)<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 />

267

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

Saved successfully!

Ooh no, something went wrong!