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

TRBinding :<br />

Binding × TypeExpr × TRANS → Binding ∗<br />

TRBinding(b, te, trans) ≡<br />

case b <strong>of</strong><br />

IdBinding(id) →<br />

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

TypeName(tn) →<br />

if tn ∈ dom trans then 〈〉 else 〈b〉 end,<br />

→ 〈b〉<br />

end,<br />

Make_ProductBinding(pb) →<br />

TRBindingList(<br />

binding_list(pb), typeExprToList(te), trans)<br />

end,<br />

/∗Transforms a binding list.∗/<br />

/∗<br />

Arguments:<br />

=======<br />

bl: the binding list<br />

tel: the corresponding type expression list<br />

Result:<br />

=======<br />

Binding_list: the imperative version <strong>of</strong> the binding<br />

list<br />

∗/<br />

TRBindingList :<br />

Binding ∗ × TypeExpr ∗ × TRANS →<br />

Binding ∗<br />

TRBindingList(bl, tel, trans) ≡<br />

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

else<br />

TRBinding(hd bl, hd tel, trans) <br />

TRBindingList(tl bl, tl tel, trans)<br />

end,<br />

/∗Transforms an if expression.∗/<br />

/∗<br />

Arguments:<br />

=======<br />

ie: the if expression<br />

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

Result:<br />

=======<br />

215

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

Saved successfully!

Ooh no, something went wrong!