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

/∗Checks if one <strong>of</strong> the ids <strong>of</strong> the type expression<br />

list is in the Idset.∗/<br />

/∗<br />

Arguments:<br />

=======<br />

tel: the type expression list<br />

idset: the set <strong>of</strong> ids, either the domain or range<br />

<strong>of</strong> TRANS<br />

Results:<br />

=====<br />

Bool: true if on <strong>of</strong> the ids <strong>of</strong> the type expression<br />

list is in the idset, false otherwise<br />

∗/<br />

includesTRANSNameList :<br />

TypeExpr ∗ × Id-set → Bool<br />

includesTRANSNameList(tel, idset) ≡<br />

if tel = 〈〉 then false<br />

else<br />

includesTRANSName(Known(hd tel), idset) ∨<br />

includesTRANSNameList(tl tel, idset)<br />

end,<br />

/∗Gets the variable name corresponding to a type<br />

<strong>of</strong> interest.<br />

Pre_condition: et = Known(TypeName(id)).∗/<br />

/∗<br />

Arguments:<br />

=======<br />

et: the expected type<br />

Result:<br />

=======<br />

ValueExpr: the corresponding ValueOrVariableName<br />

∗/<br />

getTRANS : ExpType × TRANS → ValueExpr<br />

getTRANS(et, trans) ≡<br />

case et <strong>of</strong><br />

Known(te) →<br />

case te <strong>of</strong><br />

TypeName(tn) →<br />

Make_ValueOrVariableName(<br />

mk_ValueOrVariableName(trans(tn)))<br />

end<br />

end,<br />

280

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

Saved successfully!

Ooh no, something went wrong!