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 Arguments: ======= te: the type expression Result: ======= Access_list: the corresponding access list ∗/ getAccess : TypeExpr × TRANS → Access ∗ getAccess(te, trans) ≡ case te of TypeLiteral(literal) → 〈〉, TypeName(id) → if (id ∈ dom trans) then /∗Type of interest.∗/ 〈AccessValueOrVariableName( mk_ValueOrVariableName(id))〉 else /∗Not type of interest.∗/ 〈〉 end, TypeExprProduct(tep) → getAccessList(tep, trans), TypeExprSet(tes) → 〈〉, TypeExprList(tel) → 〈〉, TypeExprMap(tem) → 〈〉, FunctionTypeExpr(arg, fa, res) → 〈〉, BracketedTypeExpr(bte) → getAccess(bte, trans) end, /∗Returns an access list from a type expression list.∗/ /∗ Arguments: ======= tel: the type expression list Result: ======= Access_list: the corresponding access list ∗/ getAccessList : TypeExpr ∗ × TRANS → Access ∗ getAccessList(tel, trans) ≡ if tel = 〈〉 then 〈〉 else getAccess(hd tel, trans) 248

C.1. FORMAL SPECIFICATION OF THE TRANSFORMER getAccessList(tl tel, trans) end, /∗Returns an access list of the values of types of interest read from during evaluation of pre condition.∗/ /∗ Arguments: ======= idset: the functions already evaluated precond: the pre condition et: the expected type of the value expression Result: ======= AccessResult: the corresponding access result ∗/ getAccessObsOptPreCondition : Id-set × OptionalPreCondition × ExpType × FUNC × TRANS → AccessResult getAccessObsOptPreCondition( idset, precond, et, func, trans) ≡ case precond of PreCondition(ve) → getAccessObs(idset, ve, et, func, trans), NoPreCondition → mk_AccessResult(〈〉, idset) end, /∗Returns an access list of the values of types of interest read from during evaluation of a function.∗/ /∗ Arguments: ======= idset: the functions already evaluated ve: the value expression et: the expected type of the value expression Result: ======= AccessResult: the corresponding access result ∗/ getAccessObs : Id-set × ValueExpr × ExpType × FUNC × TRANS → AccessResult 249

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

getAccessList(tl tel, trans)<br />

end,<br />

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

<strong>of</strong> interest read from during evaluation <strong>of</strong> pre<br />

condition.∗/<br />

/∗<br />

Arguments:<br />

=======<br />

idset: the functions already evaluated<br />

precond: the pre condition<br />

et: the expected type <strong>of</strong> the value expression<br />

Result:<br />

=======<br />

AccessResult: the corresponding access result<br />

∗/<br />

getAccessObsOptPreCondition :<br />

Id-set × OptionalPreCondition × ExpType × FUNC ×<br />

TRANS →<br />

AccessResult<br />

getAccessObsOptPreCondition(<br />

idset, precond, et, func, trans) ≡<br />

case precond <strong>of</strong><br />

PreCondition(ve) →<br />

getAccessObs(idset, ve, et, func, trans),<br />

NoPreCondition → mk_AccessResult(〈〉, idset)<br />

end,<br />

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

<strong>of</strong> interest read from during evaluation <strong>of</strong> a<br />

function.∗/<br />

/∗<br />

Arguments:<br />

=======<br />

idset: the functions already evaluated<br />

ve: the value expression<br />

et: the expected type <strong>of</strong> the value expression<br />

Result:<br />

=======<br />

AccessResult: the corresponding access result<br />

∗/<br />

getAccessObs :<br />

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

AccessResult<br />

249

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

Saved successfully!

Ooh no, something went wrong!