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.

APPENDIX C. FORMAL SPECIFICATIONS OF TRANSFORMATIONS<br />

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

then<br />

/∗The application expression is a function application.<br />

∗/<br />

case type_expr(func(id(vn))) <strong>of</strong><br />

FunctionTypeExpr(arg, fa, res) →<br />

CheckFunctionAppl(<br />

ve, vel, typeExprToExpTypeList(arg),<br />

typings, func, trans, env, types)<br />

end<br />

else<br />

/∗The application expression is a list or map<br />

application.∗/<br />

CheckListMapAppl(<br />

ve, vel, et, typings, func, trans, env,<br />

types)<br />

end,<br />

→<br />

CheckListMapAppl(<br />

ve, vel, et, typings, func, trans, env, types)<br />

end,<br />

/∗Checks if a function application can be transformed.<br />

∗/<br />

/∗<br />

Arguments:<br />

=======<br />

ve: the value expression<br />

vel: the arguments <strong>of</strong> the function application<br />

et: the expected types <strong>of</strong> the arguments <strong>of</strong> the<br />

function application<br />

Results:<br />

=====<br />

Bool: true if the function application is transformable,<br />

false otherwise<br />

∗/<br />

CheckFunctionAppl :<br />

ValueExpr × ValueExpr ∗ × ExpType ∗ ×<br />

TYPINGS × FUNC × TRANS × ENV × TYPES →<br />

Bool × ENV × TYPES<br />

CheckFunctionAppl(<br />

ve, vel, etl, typings, func, trans, env, types) ≡<br />

let<br />

(b, env ′ , types ′ ) =<br />

172

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

Saved successfully!

Ooh no, something went wrong!