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.

C.1. FORMAL SPECIFICATION OF THE TRANSFORMER<br />

<strong>of</strong> type names<br />

<strong>of</strong> the type <strong>of</strong> interest, false otherwise<br />

∗/<br />

onlyTOIArgument :<br />

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

onlyTOIArgument(vel, trans, types) ≡<br />

if vel = 〈〉 then true<br />

else<br />

case hd vel <strong>of</strong><br />

Make_ValueOrVariableName(vn) →<br />

if isinBinding(IdBinding(id(vn)), dom types)<br />

then<br />

if<br />

checkTRANS(<br />

types(IdBinding(id(vn))), dom trans)<br />

then onlyTOIArgument(tl vel, trans, types)<br />

else false<br />

end<br />

else false<br />

end,<br />

→ false<br />

end<br />

end,<br />

/∗Checks if a value expression returns other values<br />

than values <strong>of</strong> the type <strong>of</strong> interest.∗/<br />

/∗<br />

Arguments:<br />

=======<br />

ve: the value expression<br />

et: the expected type <strong>of</strong> the value expression<br />

Result:<br />

=======<br />

Bool: true if the value expression returns values<br />

not <strong>of</strong> the type <strong>of</strong> interest, false otherwise<br />

∗/<br />

returnsNonTOI :<br />

ValueExpr × ExpType × TRANS × FUNC → Bool<br />

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

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

ApplicationExpr(vea, vel) →<br />

case vea <strong>of</strong><br />

Make_ValueOrVariableName(vn) →<br />

case type_expr(func(id(vn))) <strong>of</strong><br />

241

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

Saved successfully!

Ooh no, something went wrong!