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

CheckLetDefList(ldl, typings, func, trans, env, types) ≡<br />

if ldl = 〈〉 then (true, env, types)<br />

else<br />

let<br />

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

CheckLetDef(<br />

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

in<br />

if b<br />

then<br />

CheckLetDefList(<br />

tl ldl, typings, func, trans, env ′ , types ′ )<br />

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

end<br />

end<br />

end,<br />

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

definition.<br />

∗/<br />

/∗<br />

Arguments:<br />

=======<br />

ld: the let definition<br />

Results:<br />

=======<br />

Bool: true if the let defition can be transformed,<br />

false otherwise<br />

∗/<br />

CheckLetDef :<br />

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

Bool × ENV × TYPES<br />

CheckLetDef(ld, typings, func, trans, env, types) ≡<br />

let<br />

(bb, envb, types ′ ) =<br />

CheckLetBinding(<br />

binding(ld), typings, func, trans, env, types)<br />

in<br />

if ∼ bb then (false, env, types)<br />

else<br />

case value_expr(ld) <strong>of</strong><br />

ApplicationExpr(ve, vel) →<br />

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

Make_ValueOrVariableName(vn) →<br />

175

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

Saved successfully!

Ooh no, something went wrong!