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

=======<br />

al: the access list<br />

Result:<br />

=======<br />

Access_list: the resulting access list<br />

∗/<br />

toVariableList : Access ∗ × TRANS → Access ∗<br />

toVariableList(al, trans) ≡<br />

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

else<br />

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

AccessValueOrVariableName(vn) →<br />

if id(vn) ∈ dom trans<br />

then<br />

〈AccessValueOrVariableName(<br />

mk_ValueOrVariableName(trans(id(vn))))〉 <br />

toVariableList(tl al, trans)<br />

else toVariableList(tl al, trans)<br />

end<br />

end<br />

end,<br />

/∗Removes duplets from an access list.∗/<br />

/∗<br />

Arguments:<br />

=======<br />

al: the access list<br />

Result:<br />

=======<br />

Access_list: the resulting access list<br />

∗/<br />

removeDuplets : Access ∗ → Access ∗<br />

removeDuplets(al) ≡<br />

if len al = card elems al then al<br />

else<br />

if hd al ∈ elems tl al<br />

then removeDuplets(tl al)<br />

else 〈hd al〉 removeDuplets(tl al)<br />

end<br />

end,<br />

/∗Gets an access list from a type expression.<br />

∗/<br />

/∗<br />

247

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

Saved successfully!

Ooh no, something went wrong!