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 makeFuncMap : ValueDef ∗ × FUNC × TRANS → FUNC makeFuncMap(vdl, func, trans) ≡ if vdl = 〈〉 then func else makeFuncMap( tl vdl, overrideFUNC( func, getMapEntrance(hd vdl, trans)), trans) end, getMapEntrance : ValueDef × TRANS → FUNC getMapEntrance(vd, trans) ≡ case vd of ExplicitValueDef(st, ve) → if includesTRANSName( Known(type_expr(st)), domainTRANS(trans)) then case binding(st) of IdBinding(id) → mk_FUNC( 〈mk_FUNCMapEntrance( id, mk_FuncSpec( FunctionTypeExpr( TypeLiteral(UNIT), TOTAL_FUNCTION_ARROW, mk_ResultDesc( NoReadAccessMode, NoWriteAccessMode, type_expr(st))), ve, 〈〉, 〈〉))〉), Make_ProductBinding(pb) → mk_FUNC(〈〉) end else mk_FUNC(〈〉) end, ExplicitFunctionDef(st, ffa, ve, precond) → case binding(st) of IdBinding(id) → mk_FUNC( 〈mk_FUNCMapEntrance( id, mk_FuncSpec( 456

D.2. FORMAL SPECIFICATION OF THE TRANSFORMER IN RSL1 end, end type_expr(st), ve, 〈〉, 〈〉))〉) expandFuncMap : ValueDef ∗ × FUNC × TRANS → FUNC expandFuncMap(vdl, func, trans) ≡ if vdl = 〈〉 then func else expandFuncMap( tl vdl, overrideFUNC( func, expandMapEntrance(hd vdl, func, trans)), trans) end, expandMapEntrance : ValueDef × FUNC × TRANS → FUNC expandMapEntrance(vd, func, trans) ≡ case vd of ExplicitValueDef(st, ve) → if includesTRANSName( Known(type_expr(st)), domainTRANS(trans)) then case binding(st) of IdBinding(id) → mk_FUNC( 〈mk_FUNCMapEntrance( id, mk_FuncSpec( FunctionTypeExpr( TypeLiteral(UNIT), TOTAL_FUNCTION_ARROW, mk_ResultDesc( NoReadAccessMode, NoWriteAccessMode, type_expr(st))), ve, 〈〉, removeDuplets( getAccess( type_expr(st), trans) accessList( getAccessGen( 〈id〉, ve, Known(type_expr(st)), 457

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

makeFuncMap : ValueDef ∗ × FUNC × TRANS → FUNC<br />

makeFuncMap(vdl, func, trans) ≡<br />

if vdl = 〈〉 then func<br />

else<br />

makeFuncMap(<br />

tl vdl,<br />

overrideFUNC(<br />

func, getMapEntrance(hd vdl, trans)), trans)<br />

end,<br />

getMapEntrance : ValueDef × TRANS → FUNC<br />

getMapEntrance(vd, trans) ≡<br />

case vd <strong>of</strong><br />

ExplicitValueDef(st, ve) →<br />

if<br />

includesTRANSName(<br />

Known(type_expr(st)), domainTRANS(trans))<br />

then<br />

case binding(st) <strong>of</strong><br />

IdBinding(id) →<br />

mk_FUNC(<br />

〈mk_FUNCMapEntrance(<br />

id,<br />

mk_FuncSpec(<br />

FunctionTypeExpr(<br />

TypeLiteral(UNIT),<br />

TOTAL_FUNCTION_ARROW,<br />

mk_ResultDesc(<br />

NoReadAccessMode,<br />

NoWriteAccessMode,<br />

type_expr(st))), ve,<br />

〈〉, 〈〉))〉),<br />

Make_ProductBinding(pb) → mk_FUNC(〈〉)<br />

end<br />

else mk_FUNC(〈〉)<br />

end,<br />

ExplicitFunctionDef(st, ffa, ve, precond) →<br />

case binding(st) <strong>of</strong><br />

IdBinding(id) →<br />

mk_FUNC(<br />

〈mk_FUNCMapEntrance(<br />

id,<br />

mk_FuncSpec(<br />

456

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

Saved successfully!

Ooh no, something went wrong!