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 Make_ValueLiteral(vl) → true, Make_ValueOrVariableName(vn) → true, Make_BasicExpr(be) → true, ProductExpr(vel) → CheckPreCondGenProduct(vel, func, trans, types), Make_SetExpr(setExpr) → CheckPreCondGenSet(setExpr, func, trans, types), Make_ListExpr(listExpr) → CheckPreCondGenList(listExpr, func, trans, types), Make_MapExpr(mapExpr) → CheckPreCondGenMap(mapExpr, func, trans, types), ApplicationExpr(ave, vl) → CheckPreCondApplicationExpr( ave, vl, func, trans, types), BracketedExpr(bve) → CheckPreCondGen(bve, func, trans, types), ValueInfixExpr(first, op, second) → and( CheckPreCondGen(first, func, trans, types), CheckPreCondGen(second, func, trans, types)), ValuePrefixExpr(op, operand) → CheckPreCondGen(operand, func, trans, types), LetExpr(ldl, lve) → and( CheckPreCondGenLetDef(ldl, func, trans, types), CheckPreCondGen(lve, func, trans, types)), Make_IfExpr(ie) → and( and( and( CheckPreCondGen( condition(ie), func, trans, types), CheckPreCondGen( if_case(ie), func, trans, types)), CheckPreCondGenElsif( elsif_list(ie), func, trans, types)), CheckPreCondGen( else_case(ie), func, trans, types)), CaseExpr(cond, cbl) → and( CheckPreCondGen(cond, func, trans, types), CheckPreCondGenCaseBranch( cbl, func, trans, types)) end, 320

D.2. FORMAL SPECIFICATION OF THE TRANSFORMER IN RSL1 CheckPreCondGenProduct : ValueExpr ∗ × FUNC × TRANS × TYPES → Bool CheckPreCondGenProduct(vel, func, trans, types) ≡ if vel = 〈〉 then true else and( CheckPreCondGen(hd vel, func, trans, types), CheckPreCondGenProduct( tl vel, func, trans, types)) end, CheckPreCondGenSet : SetExpr × FUNC × TRANS × TYPES → Bool CheckPreCondGenSet(se, func, trans, types) ≡ case se of RangedSetExpr(first, second) → and( CheckPreCondGen(first, func, trans, types), CheckPreCondGen(second, func, trans, types)), EnumeratedSetExpr(ovel) → case ovel of ValueExprList(vel) → CheckPreCondGenProduct( vel, func, trans, types), NoValueExprList → true end, ComprehendedSetExpr(ve, t, or) → and( CheckPreCondGen(ve, func, trans, types), CheckPreCondOptRestriction( or, func, trans, types)) end, CheckPreCondGenList : ListExpr × FUNC × TRANS × TYPES → Bool CheckPreCondGenList(le, func, trans, types) ≡ case le of RangedListExpr(first, second) → and( CheckPreCondGen(first, func, trans, types), CheckPreCondGen(second, func, trans, types)), EnumeratedListExpr(ovel) → case ovel of 321

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

CheckPreCondGenProduct :<br />

ValueExpr ∗ × FUNC × TRANS × TYPES → Bool<br />

CheckPreCondGenProduct(vel, func, trans, types) ≡<br />

if vel = 〈〉 then true<br />

else<br />

and(<br />

CheckPreCondGen(hd vel, func, trans, types),<br />

CheckPreCondGenProduct(<br />

tl vel, func, trans, types))<br />

end,<br />

CheckPreCondGenSet :<br />

SetExpr × FUNC × TRANS × TYPES → Bool<br />

CheckPreCondGenSet(se, func, trans, types) ≡<br />

case se <strong>of</strong><br />

RangedSetExpr(first, second) →<br />

and(<br />

CheckPreCondGen(first, func, trans, types),<br />

CheckPreCondGen(second, func, trans, types)),<br />

EnumeratedSetExpr(ovel) →<br />

case ovel <strong>of</strong><br />

ValueExprList(vel) →<br />

CheckPreCondGenProduct(<br />

vel, func, trans, types),<br />

NoValueExprList → true<br />

end,<br />

ComprehendedSetExpr(ve, t, or) →<br />

and(<br />

CheckPreCondGen(ve, func, trans, types),<br />

CheckPreCondOptRestriction(<br />

or, func, trans, types))<br />

end,<br />

CheckPreCondGenList :<br />

ListExpr × FUNC × TRANS × TYPES → Bool<br />

CheckPreCondGenList(le, func, trans, types) ≡<br />

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

RangedListExpr(first, second) →<br />

and(<br />

CheckPreCondGen(first, func, trans, types),<br />

CheckPreCondGen(second, func, trans, types)),<br />

EnumeratedListExpr(ovel) →<br />

case ovel <strong>of</strong><br />

321

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

Saved successfully!

Ooh no, something went wrong!