Transformation of Applicative Specifications into Imperative ...

Transformation of Applicative Specifications into Imperative ... Transformation of Applicative Specifications into Imperative ...

26.09.2013 Views

APPENDIX C. FORMAL SPECIFICATIONS OF TRANSFORMATIONS id ∈ elems typings(id), AbbreviationDef(id, te) → CheckTypeExpr(te, typings, func, trans) ∧ id ∈ elems typings(id) end, /∗Checks for transformability of a variant list. ∗/ /∗ Arguments: ======= id: the id of the variant definition vl: the list of variants Results: ===== Bool: true if the list is transformable, false otherwise ∗/ CheckVariantList : Id × Variant ∗ × TYPINGS × FUNC × TRANS → Bool CheckVariantList(id, vl, typings, func, trans) ≡ if vl = 〈〉 then true else CheckVariant(id, hd vl, typings, func, trans) ∧ CheckVariantList(id, tl vl, typings, func, trans) end, /∗Checks for transformability of a variant.∗/ /∗ Arguments: ======= id: the id of the variant definition v: the variant Results: ===== Bool: true if the variant is transformable, false otherwise ∗/ CheckVariant : Id × Variant × TYPINGS × FUNC × TRANS → Bool CheckVariant(id, v, typings, func, trans) ≡ case v of RecordVariant(c, cl) → 148

C.1. FORMAL SPECIFICATION OF THE TRANSFORMER CheckComponentKindList( id, cl, typings, func, trans), → true end, /∗Checks for transformability of a component kind list.∗/ /∗ Arguments: ======= id: the id of the type definition cl: the list of component kinds Results: ===== Bool: true if the list is transformable, false otherwise ∗/ CheckComponentKindList : Id × ComponentKind ∗ × TYPINGS × FUNC × TRANS → Bool CheckComponentKindList(id, cl, typings, func, trans) ≡ if cl = 〈〉 then true else CheckComponentKind(id, hd cl, typings, func, trans) ∧ CheckComponentKindList( id, tl cl, typings, func, trans) end, /∗Checks for transformability of a component kind. ∗/ /∗ Arguments: ======= id: the id of the type definition c: the component kind Results: ===== Bool: true if the component kind is transformable, false otherwise ∗/ CheckComponentKind : Id × ComponentKind × TYPINGS × FUNC × TRANS → Bool CheckComponentKind(id, c, typings, func, trans) ≡ 149

APPENDIX C. FORMAL SPECIFICATIONS OF TRANSFORMATIONS<br />

id ∈ elems typings(id),<br />

AbbreviationDef(id, te) →<br />

CheckTypeExpr(te, typings, func, trans) ∧<br />

id ∈ elems typings(id)<br />

end,<br />

/∗Checks for transformability <strong>of</strong> a variant list.<br />

∗/<br />

/∗<br />

Arguments:<br />

=======<br />

id: the id <strong>of</strong> the variant definition<br />

vl: the list <strong>of</strong> variants<br />

Results:<br />

=====<br />

Bool: true if the list is transformable, false<br />

otherwise<br />

∗/<br />

CheckVariantList :<br />

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

Bool<br />

CheckVariantList(id, vl, typings, func, trans) ≡<br />

if vl = 〈〉 then true<br />

else<br />

CheckVariant(id, hd vl, typings, func, trans) ∧<br />

CheckVariantList(id, tl vl, typings, func, trans)<br />

end,<br />

/∗Checks for transformability <strong>of</strong> a variant.∗/<br />

/∗<br />

Arguments:<br />

=======<br />

id: the id <strong>of</strong> the variant definition<br />

v: the variant<br />

Results:<br />

=====<br />

Bool: true if the variant is transformable, false<br />

otherwise<br />

∗/<br />

CheckVariant :<br />

Id × Variant × TYPINGS × FUNC × TRANS → Bool<br />

CheckVariant(id, v, typings, func, trans) ≡<br />

case v <strong>of</strong><br />

RecordVariant(c, cl) →<br />

148

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

Saved successfully!

Ooh no, something went wrong!