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

end,<br />

/∗Expands the TYPINGS map.∗/<br />

/∗<br />

Arguments:<br />

=======<br />

idl: the list <strong>of</strong> type def ids<br />

∗/<br />

expandTYPINGSMap :<br />

Id ∗ × TYPINGS × TRANS → TYPINGS<br />

expandTYPINGSMap(idl, typings, trans) ≡<br />

if idl = 〈〉 then typings<br />

else<br />

expandTYPINGSMap(<br />

tl idl,<br />

typings †<br />

[ hd idl ↦→<br />

removeNonTOI(<br />

getIdList(hd idl, {}, typings), dom trans) ],<br />

trans)<br />

end,<br />

/∗Removes ids not <strong>of</strong> the type <strong>of</strong> interest from<br />

an id list.∗/<br />

/∗<br />

Arguments:<br />

=======<br />

idl: the list <strong>of</strong> ids<br />

ids: a set <strong>of</strong> type names <strong>of</strong> the type <strong>of</strong> interest<br />

Results:<br />

=====<br />

Id_list: the resulting list <strong>of</strong> ids<br />

∗/<br />

removeNonTOI : Id ∗ × Id-set → Id ∗<br />

removeNonTOI(idl, ids) ≡<br />

if idl = 〈〉 then 〈〉<br />

else<br />

if hd idl ∈ ids then removeNonTOI(tl idl, ids)<br />

else 〈hd idl〉 removeNonTOI(tl idl, ids)<br />

end<br />

end,<br />

/∗Gets the ids which is part an id ′ s type.∗/<br />

/∗<br />

287

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

Saved successfully!

Ooh no, something went wrong!