Transformation of Applicative Specifications into Imperative ...
Transformation of Applicative Specifications into Imperative ... Transformation of Applicative Specifications into Imperative ...
APPENDIX C. FORMAL SPECIFICATIONS OF TRANSFORMATIONS end, end end end /∗Transforms a single typing.∗/ /∗ Arguments: ======= st: the single typing Result: ======= ValueDef: the resulting imperative version of the single typing ∗/ TRSingleTyping : SingleTyping × FUNC × TRANS → SingleTyping TRSingleTyping(st, func, trans) ≡ case binding(st) of IdBinding(id) → mk_SingleTyping( binding(st), TRTypeExpr(id, type_expr(st), func, trans)) end, /∗Transforms a type expression.∗/ /∗ Arguments: ======= id: the id of the corresponding function te: the type expression Result: ======= TypeExpr: the resulting imperative version of the type expression ∗/ TRTypeExpr : Id × TypeExpr × FUNC × TRANS → TypeExpr TRTypeExpr(id, te, func, trans) ≡ case te of TypeLiteral(literal) → te, TypeName(tid) → if (tid ∈ dom trans) then 186
C.1. FORMAL SPECIFICATION OF THE TRANSFORMER /∗Type expression of a type of interest.∗/ TypeLiteral(UNIT) else /∗Type expression not of a type of interest.∗/ te end, TypeExprProduct(tel) → TypeExprProduct( TRTypeExprList(id, tel, func, trans)), TypeExprSet(tes) → te, TypeExprList(tel) → te, TypeExprMap(tem) → te, FunctionTypeExpr(fte, fa, rd) → TRFunctionDef(id, fte, fa, rd, func, trans), BracketedTypeExpr(bte) → BracketedTypeExpr( TRTypeExpr(id, bte, func, trans)) end, /∗Transforms a type expression list.∗/ /∗ Arguments: ======= id: the id of the corresponding function tel: the type expression list Result: ======= TypeExpr_list: the resulting imperative version of the type expression list ∗/ TRTypeExprList : Id × TypeExpr ∗ × FUNC × TRANS → TypeExpr ∗ TRTypeExprList(id, tel, func, trans) ≡ if tel = 〈〉 then 〈〉 else 〈TRTypeExpr(id, hd tel, func, trans)〉 TRTypeExprList(id, tl tel, func, trans) end, /∗Transforms a function definition.∗/ /∗ Arguments: ======= id: the id of the corresponding function 187
- Page 152 and 153: APPENDIX A. USING AND EXTENDING THE
- Page 154 and 155: APPENDIX A. USING AND EXTENDING THE
- Page 156 and 157: APPENDIX B. CONTENTS OF CD-ROM 140
- Page 158 and 159: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 160 and 161: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 162 and 163: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 164 and 165: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 166 and 167: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 168 and 169: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 170 and 171: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 172 and 173: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 174 and 175: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 176 and 177: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 178 and 179: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 180 and 181: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 182 and 183: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 184 and 185: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 186 and 187: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 188 and 189: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 190 and 191: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 192 and 193: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 194 and 195: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 196 and 197: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 198 and 199: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 200 and 201: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 204 and 205: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 206 and 207: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 208 and 209: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 210 and 211: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 212 and 213: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 214 and 215: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 216 and 217: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 218 and 219: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 220 and 221: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 222 and 223: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 224 and 225: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 226 and 227: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 228 and 229: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 230 and 231: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 232 and 233: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 234 and 235: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 236 and 237: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 238 and 239: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 240 and 241: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 242 and 243: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 244 and 245: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 246 and 247: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 248 and 249: APPENDIX C. FORMAL SPECIFICATIONS O
- Page 250 and 251: APPENDIX C. FORMAL SPECIFICATIONS O
APPENDIX C. FORMAL SPECIFICATIONS OF TRANSFORMATIONS<br />
end,<br />
end<br />
end<br />
end<br />
/∗Transforms a single typing.∗/<br />
/∗<br />
Arguments:<br />
=======<br />
st: the single typing<br />
Result:<br />
=======<br />
ValueDef: the resulting imperative version <strong>of</strong><br />
the single typing<br />
∗/<br />
TRSingleTyping :<br />
SingleTyping × FUNC × TRANS → SingleTyping<br />
TRSingleTyping(st, func, trans) ≡<br />
case binding(st) <strong>of</strong><br />
IdBinding(id) →<br />
mk_SingleTyping(<br />
binding(st),<br />
TRTypeExpr(id, type_expr(st), func, trans))<br />
end,<br />
/∗Transforms a type expression.∗/<br />
/∗<br />
Arguments:<br />
=======<br />
id: the id <strong>of</strong> the corresponding function<br />
te: the type expression<br />
Result:<br />
=======<br />
TypeExpr: the resulting imperative version <strong>of</strong><br />
the type expression<br />
∗/<br />
TRTypeExpr :<br />
Id × TypeExpr × FUNC × TRANS → TypeExpr<br />
TRTypeExpr(id, te, func, trans) ≡<br />
case te <strong>of</strong><br />
TypeLiteral(literal) → te,<br />
TypeName(tid) →<br />
if (tid ∈ dom trans)<br />
then<br />
186