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

Results:<br />

=====<br />

ExpType: the expected type <strong>of</strong> the arguments<br />

∗/<br />

getListMapTypeArg : ExpType → ExpType<br />

getListMapTypeArg(et) ≡<br />

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

Known(te) →<br />

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

TypeExprList(tel) →<br />

Known(TypeExprProduct(〈TypeLiteral(INT)〉)),<br />

TypeExprMap(tem) →<br />

case tem <strong>of</strong><br />

FiniteMapTypeExpr(tedom, terange) →<br />

Known(TypeExprProduct(〈tedom〉)),<br />

InfiniteMapTypeExpr(tedom, terange) →<br />

Known(TypeExprProduct(〈tedom〉))<br />

end,<br />

→ et<br />

end,<br />

Unknown → Unknown<br />

end,<br />

/∗Removes outer brackets from a expected type.<br />

∗/<br />

/∗<br />

Arguments:<br />

=======<br />

et: the expected type<br />

Result:<br />

=======<br />

ExpType: the resulting expected type<br />

∗/<br />

removeBrackets : ExpType → ExpType<br />

removeBrackets(et) ≡<br />

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

Known(te) →<br />

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

BracketedTypeExpr(bte) → Known(bte),<br />

→ et<br />

end,<br />

→ et<br />

end,<br />

235

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

Saved successfully!

Ooh no, something went wrong!