26.09.2013 Views

Transformation of Applicative Specifications into Imperative ...

Transformation of Applicative Specifications into Imperative ...

Transformation of Applicative Specifications into Imperative ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

APPENDIX C. FORMAL SPECIFICATIONS OF TRANSFORMATIONS<br />

the value expression pair list<br />

∗/<br />

TRValueExprPairListOpt :<br />

ValueExprPair ∗ × MapType × FUNC × TRANS ×<br />

TYPES →<br />

ValueExprPair ∗ × TYPES<br />

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

if vel = 〈〉 then (〈〉, types)<br />

else<br />

let<br />

(ve1, types1) =<br />

TRValueExpr(<br />

first(hd vel), tedom(et), func, trans, types<br />

),<br />

(ve2, types2) =<br />

TRValueExpr(<br />

second(hd vel), terange(et), func, trans,<br />

types1),<br />

(vel ′ , types ′′ ) =<br />

TRValueExprPairListOpt(<br />

tl vel, et, func, trans, types2)<br />

in<br />

(〈mk_ValueExprPair(ve1, ve2)〉 vel ′ , types ′′ )<br />

end<br />

end,<br />

/∗Transforms an optional restriction.∗/<br />

/∗<br />

Arguments:<br />

=======<br />

or: the optional restriction<br />

et: the expected type the optional restriction<br />

Result:<br />

=======<br />

OptionalRestriction: the imperative version <strong>of</strong><br />

the optional restriction<br />

∗/<br />

TROptRestriction :<br />

OptionalRestriction × ExpType × FUNC × TRANS ×<br />

TYPES →<br />

OptionalRestriction × TYPES<br />

TROptRestriction(or, et, func, trans, types) ≡<br />

case or <strong>of</strong><br />

Restriction(ve) →<br />

206

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

Saved successfully!

Ooh no, something went wrong!