Transformation of Applicative Specifications into Imperative ...

Transformation of Applicative Specifications into Imperative ... Transformation of Applicative Specifications into Imperative ...

26.09.2013 Views

APPENDIX D. SPECIFICATION OF TRANSFORMER IN RSL1 removeDupletsId( 〈hd idl〉 getIdListIdList(tl idl, ids, typings)) end end, /∗**** TYPINGS map ****∗/ overrideTYPINGS : TYPINGS × TYPINGS → TYPINGS overrideTYPINGS(t1, t2) ≡ if getTYPINGSMapEntranceList(t1) = 〈〉 then t2 else if isinId( getTypeIdTYPINGS( hd getTYPINGSMapEntranceList(t1)), domainTYPINGS(t2)) then overrideTYPINGS( mk_TYPINGS(tl getTYPINGSMapEntranceList(t1)), t2) else overrideTYPINGS( mk_TYPINGS(tl getTYPINGSMapEntranceList(t1)), mk_TYPINGS( getTYPINGSMapEntranceList(t2) 〈hd getTYPINGSMapEntranceList(t1)〉)) end end, getMapValueTYPINGS : TYPINGS × Id → Id ∗ getMapValueTYPINGS(typings, id) ≡ if getTextId( getTypeIdTYPINGS( hd getTYPINGSMapEntranceList(typings))) = getTextId(id) then getTypeListTYPINGS( hd getTYPINGSMapEntranceList(typings)) else getMapValueTYPINGS( mk_TYPINGS( tl getTYPINGSMapEntranceList(typings)), id) 454

D.2. FORMAL SPECIFICATION OF THE TRANSFORMER IN RSL1 end, domainTYPINGS : TYPINGS → Id ∗ domainTYPINGS(typings) ≡ if getTYPINGSMapEntranceList(typings) = 〈〉 then 〈〉 else 〈getTypeIdTYPINGS( hd getTYPINGSMapEntranceList(typings))〉 domainTYPINGS( mk_TYPINGS( tl getTYPINGSMapEntranceList(typings))) end, getTypeIdTYPINGS : TYPINGSMapEntrance → Id getTypeIdTYPINGS(te) ≡ type_id(te), getTypeListTYPINGS : TYPINGSMapEntrance → Id ∗ getTypeListTYPINGS(te) ≡ id_list(te), getTYPINGSMapEntranceList : TYPINGS → TYPINGSMapEntrance ∗ getTYPINGSMapEntranceList(typings) ≡ map(typings), /∗**** TYPINGS end ****∗/ /∗**** FUNC ****∗/ establishFuncMap : Decl ∗ × TRANS → FUNC establishFuncMap(dl, trans) ≡ expandFuncMap( getValueDecl(dl), makeFuncMap( getValueDecl(dl), mk_FUNC(〈〉), trans), trans), getValueDecl : Decl ∗ → ValueDef ∗ getValueDecl(dl) ≡ if dl = 〈〉 then 〈〉 else case hd dl of ValueDecl(vdl) → vdl getValueDecl(tl dl), → getValueDecl(tl dl) end end, 455

D.2. FORMAL SPECIFICATION OF THE TRANSFORMER IN RSL1<br />

end,<br />

domainTYPINGS : TYPINGS → Id ∗<br />

domainTYPINGS(typings) ≡<br />

if getTYPINGSMapEntranceList(typings) = 〈〉<br />

then 〈〉<br />

else<br />

〈getTypeIdTYPINGS(<br />

hd getTYPINGSMapEntranceList(typings))〉 <br />

domainTYPINGS(<br />

mk_TYPINGS(<br />

tl getTYPINGSMapEntranceList(typings)))<br />

end,<br />

getTypeIdTYPINGS : TYPINGSMapEntrance → Id<br />

getTypeIdTYPINGS(te) ≡ type_id(te),<br />

getTypeListTYPINGS : TYPINGSMapEntrance → Id ∗<br />

getTypeListTYPINGS(te) ≡ id_list(te),<br />

getTYPINGSMapEntranceList :<br />

TYPINGS → TYPINGSMapEntrance ∗<br />

getTYPINGSMapEntranceList(typings) ≡ map(typings),<br />

/∗**** TYPINGS end ****∗/<br />

/∗**** FUNC ****∗/<br />

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

establishFuncMap(dl, trans) ≡<br />

expandFuncMap(<br />

getValueDecl(dl),<br />

makeFuncMap(<br />

getValueDecl(dl), mk_FUNC(〈〉), trans), trans),<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 />

455

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

Saved successfully!

Ooh no, something went wrong!