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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

C.1. FORMAL SPECIFICATION OF THE TRANSFORMER<br />

case ve <strong>of</strong><br />

Make_ValueLiteral(vl) →<br />

(makeAssignExpr(ve, et, trans), types),<br />

Make_ValueOrVariableName(vn) →<br />

if ∼ isinBinding(IdBinding(id(vn)), dom types)<br />

then<br />

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

then /∗Constant <strong>of</strong> the type <strong>of</strong> interest.∗/<br />

TRValueExpr(<br />

ApplicationExpr(ve, 〈〉), et, func,<br />

trans, types)<br />

else (ve, types)<br />

end<br />

else<br />

if<br />

checkTRANS(<br />

types(IdBinding(id(vn))), dom trans)<br />

then<br />

/∗The value expression is <strong>of</strong> a type <strong>of</strong> interest.<br />

∗/<br />

(makeAssignExpr(<br />

getTRANS(types(IdBinding(id(vn))), trans),<br />

et, trans), types)<br />

else<br />

/∗The value expression is not <strong>of</strong> a type <strong>of</strong> interest.<br />

∗/<br />

(makeAssignExpr(ve, et, trans), types)<br />

end<br />

end,<br />

Make_BasicExpr(be) → (ve, types),<br />

ProductExpr(vel) →<br />

let<br />

(vel ′ , types ′ ) =<br />

TRValueExprListProductFunc(<br />

vel,<br />

expTypeToExpTypeList(<br />

removeBrackets(et), len vel), func,<br />

trans, types)<br />

in<br />

if<br />

containsGen(<br />

vel,<br />

expTypeToExpTypeList(<br />

removeBrackets(et), len vel), trans,<br />

195

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

Saved successfully!

Ooh no, something went wrong!