Transformation of Applicative Specifications into Imperative ...

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

26.09.2013 Views

APPENDIX D. SPECIFICATION OF TRANSFORMER IN RSL1 func, trans)))))〉), Make_ProductBinding(pb) → mk_FUNC(〈〉) end else mk_FUNC(〈〉) end, ExplicitFunctionDef(st, ffa, ve, precond) → case binding(st) of IdBinding(id) → case type_expr(st) of FunctionTypeExpr(arg, fa, res) → mk_FUNC( 〈mk_FUNCMapEntrance( id, mk_FuncSpec( type_expr(st), ve, removeDuplets( getAccess(arg, trans) accessList( getAccessObs( 〈id〉, ve, Known(type_expr(res)), func, trans)) accessList( getAccessObsOptPreCondition( 〈id〉, precond, Known( TypeLiteral(BOOL)), func, trans))), removeDuplets( getAccess( type_expr(res), trans) accessList( getAccessGen( 〈id〉, ve, Known(type_expr(res)), func, trans)))))〉) end end end, /∗**** FUNC map ****∗/ domainFUNC : FUNC → Id ∗ domainFUNC(func) ≡ 458

D.2. FORMAL SPECIFICATION OF THE TRANSFORMER IN RSL1 if getFUNCMapEntranceList(func) = 〈〉 then 〈〉 else 〈getFirstFUNC(hd getFUNCMapEntranceList(func))〉 domainFUNC( mk_FUNC(tl getFUNCMapEntranceList(func))) end, getMapValueFUNC : FUNC × Id → FuncSpec getMapValueFUNC(func, id) ≡ if getTextIdFUNC( getFirstFUNC(hd getFUNCMapEntranceList(func))) = getTextIdFUNC(id) then getSecondFUNC(hd getFUNCMapEntranceList(func)) else getMapValueFUNC( mk_FUNC(tl getFUNCMapEntranceList(func)), id) end, overrideFUNC : FUNC × FUNC → FUNC overrideFUNC(f1, f2) ≡ if getFUNCMapEntranceList(f1) = 〈〉 then f2 else if isinId( getFirstFUNC(hd getFUNCMapEntranceList(f1)), domainFUNC(f2)) then overrideFUNC( mk_FUNC(tl getFUNCMapEntranceList(f1)), f2) else overrideFUNC( mk_FUNC(tl getFUNCMapEntranceList(f1)), mk_FUNC( getFUNCMapEntranceList(f2) 〈hd getFUNCMapEntranceList(f1)〉)) end end, getFirstFUNC : FUNCMapEntrance → Id getFirstFUNC(me) ≡ first(me), getSecondFUNC : FUNCMapEntrance → FuncSpec getSecondFUNC(me) ≡ second(me), 459

D.2. FORMAL SPECIFICATION OF THE TRANSFORMER IN RSL1<br />

if getFUNCMapEntranceList(func) = 〈〉 then 〈〉<br />

else<br />

〈getFirstFUNC(hd getFUNCMapEntranceList(func))〉 <br />

domainFUNC(<br />

mk_FUNC(tl getFUNCMapEntranceList(func)))<br />

end,<br />

getMapValueFUNC : FUNC × Id → FuncSpec<br />

getMapValueFUNC(func, id) ≡<br />

if<br />

getTextIdFUNC(<br />

getFirstFUNC(hd getFUNCMapEntranceList(func))) =<br />

getTextIdFUNC(id)<br />

then getSecondFUNC(hd getFUNCMapEntranceList(func))<br />

else<br />

getMapValueFUNC(<br />

mk_FUNC(tl getFUNCMapEntranceList(func)), id)<br />

end,<br />

overrideFUNC : FUNC × FUNC → FUNC<br />

overrideFUNC(f1, f2) ≡<br />

if getFUNCMapEntranceList(f1) = 〈〉 then f2<br />

else<br />

if<br />

isinId(<br />

getFirstFUNC(hd getFUNCMapEntranceList(f1)),<br />

domainFUNC(f2))<br />

then<br />

overrideFUNC(<br />

mk_FUNC(tl getFUNCMapEntranceList(f1)), f2)<br />

else<br />

overrideFUNC(<br />

mk_FUNC(tl getFUNCMapEntranceList(f1)),<br />

mk_FUNC(<br />

getFUNCMapEntranceList(f2) <br />

〈hd getFUNCMapEntranceList(f1)〉))<br />

end<br />

end,<br />

getFirstFUNC : FUNCMapEntrance → Id<br />

getFirstFUNC(me) ≡ first(me),<br />

getSecondFUNC : FUNCMapEntrance → FuncSpec<br />

getSecondFUNC(me) ≡ second(me),<br />

459

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

Saved successfully!

Ooh no, something went wrong!