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

else<br />

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

then (true, env, types)<br />

else<br />

if<br />

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

then<br />

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

∗/<br />

(false, env, types)<br />

else<br />

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

∗/<br />

(true, env, types)<br />

end<br />

end<br />

end,<br />

WildcardPattern → (true, env, types),<br />

ProductPattern(pl) →<br />

CheckPatternList(pl, func, trans, env, types),<br />

RecordPattern(vn, pl) →<br />

if id(vn) ∈ dom func then (false, env, types)<br />

else<br />

CheckPatternList(pl, func, trans, env, types)<br />

end,<br />

MakeListPattern(lp) →<br />

CheckListPattern(lp, func, trans, env, types)<br />

end,<br />

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

∗/<br />

/∗<br />

Arguments:<br />

=======<br />

pl: the pattern list<br />

Results:<br />

=======<br />

Bool: true if the pattern list can be transformed,<br />

false otherwise<br />

∗/<br />

CheckPatternList :<br />

Pattern ∗ × FUNC × TRANS × ENV × TYPES →<br />

Bool × ENV × TYPES<br />

CheckPatternList(pl, func, trans, env, types) ≡<br />

181

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

Saved successfully!

Ooh no, something went wrong!