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

/∗Establishes the FUNC map from a value declaration<br />

list.∗/<br />

/∗<br />

Arguments:<br />

=======<br />

dl: the value declaration list<br />

∗/<br />

establishFuncMap : Decl ∗ × TRANS → FUNC<br />

establishFuncMap(dl, trans) ≡<br />

let vdl = getValueDecl(dl) in<br />

expandFuncMap(<br />

vdl, makeFuncMap(vdl, [ ], trans), trans)<br />

end,<br />

/∗Gets a value definition list from a declaration<br />

list.∗/<br />

/∗<br />

Arguments:<br />

=======<br />

dl: the declaration list<br />

Result:<br />

=======<br />

ValueDef_list: the corresponding value definition<br />

list<br />

∗/<br />

getValueDecl : Decl ∗ → ValueDef ∗<br />

getValueDecl(dl) ≡<br />

if dl = 〈〉 then 〈〉<br />

else<br />

case hd dl <strong>of</strong><br />

ValueDecl(vdl) → vdl getValueDecl(tl dl),<br />

→ getValueDecl(tl dl)<br />

end<br />

end,<br />

/∗Establishes the FUNC map from a value definition<br />

list.∗/<br />

/∗<br />

Arguments:<br />

=======<br />

vdl: the value definition list<br />

∗/<br />

makeFuncMap : ValueDef ∗ × FUNC × TRANS → FUNC<br />

makeFuncMap(vdl, func, trans) ≡<br />

289

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

Saved successfully!

Ooh no, something went wrong!