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 getAccessList(tl tel, trans) end, getAccessObsOptPreCondition : Id ∗ × 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, getAccessObs : Id ∗ × ValueExpr × ExpType × FUNC × TRANS → AccessResult getAccessObs(idset, ve, et, func, trans) ≡ case ve of Make_ValueLiteral(vl) → mk_AccessResult(〈〉, idset), Make_ValueOrVariableName(vn) → mk_AccessResult(〈〉, idset), Make_BasicExpr(be) → mk_AccessResult(〈〉, idset), ProductExpr(vel) → getAccessObsList(idset, vel, et, func, trans), Make_SetExpr(se) → getAccessObsSetExpr( idset, se, getSetType(et), func, trans), Make_ListExpr(le) → getAccessObsListExpr( idset, le, getListType(et), func, trans), Make_MapExpr(me) → getAccessObsMapExpr( idset, me, getMapType(et), func, trans), ApplicationExpr(ave, vl) → case ave of Make_ValueOrVariableName(vn) → if isinId(id(vn), domainFUNC(func)) then if isinId(id(vn), idset) then case 424

D.2. FORMAL SPECIFICATION OF THE TRANSFORMER IN RSL1 of type_expr( getMapValueFUNC(func, id(vn))) FunctionTypeExpr(arg, fa, res) → /∗Already evaluated.∗/ mk_AccessResult( removeDuplets( accessList( getAccessObsListList( idset, vl, expTypeList( arg, lengthVE(vl)), func, trans)) getSequencingAccess( ve, type_expr(res), et, trans, func)), getAccessIdSet( getAccessObsListList( idset, vl, expTypeList( arg, lengthVE(vl)), func, trans))) end else /∗Not evaluated yet.∗/ case type_expr( getMapValueFUNC(func, id(vn))) of FunctionTypeExpr(arg, fa, res) → mk_AccessResult( removeDuplets( (getAccess(arg, trans) accessList( getAccessObs( addId(id(vn), idset), value_expr( getMapValueFUNC( func, id(vn))), Known(type_expr(res)), func, trans))) accessList( getAccessObsListList( idset, vl, 425

APPENDIX D. SPECIFICATION OF TRANSFORMER IN RSL1<br />

getAccessList(tl tel, trans)<br />

end,<br />

getAccessObsOptPreCondition :<br />

Id ∗ × OptionalPreCondition × ExpType ×<br />

FUNC × 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 />

getAccessObs :<br />

Id ∗ × ValueExpr × ExpType × FUNC × TRANS →<br />

AccessResult<br />

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

case ve <strong>of</strong><br />

Make_ValueLiteral(vl) →<br />

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

Make_ValueOrVariableName(vn) →<br />

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

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

ProductExpr(vel) →<br />

getAccessObsList(idset, vel, et, func, trans),<br />

Make_SetExpr(se) →<br />

getAccessObsSetExpr(<br />

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

Make_ListExpr(le) →<br />

getAccessObsListExpr(<br />

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

Make_MapExpr(me) →<br />

getAccessObsMapExpr(<br />

idset, me, getMapType(et), func, trans),<br />

ApplicationExpr(ave, vl) →<br />

case ave <strong>of</strong><br />

Make_ValueOrVariableName(vn) →<br />

if isinId(id(vn), domainFUNC(func))<br />

then<br />

if isinId(id(vn), idset)<br />

then<br />

case<br />

424

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

Saved successfully!

Ooh no, something went wrong!