Transformation of Applicative Specifications into Imperative ...
Transformation of Applicative Specifications into Imperative ... Transformation of Applicative Specifications into Imperative ...
APPENDIX C. FORMAL SPECIFICATIONS OF TRANSFORMATIONS /∗Transforms a list of value declarations.∗/ /∗ Arguments: ======= vdl: the list of value declarations Results: ===== DResult: the result ∗/ TRValueDecl : ValueDef ∗ × TYPINGS × FUNC × TRANS → DResult TRValueDecl(vdl, typings, func, trans) ≡ if CheckValueDefList(vdl, typings, func, trans) then /∗The value declaration list is transformable and is transformed.∗/ Transformable( ValueDecl(TRValueDefList(vdl, func, trans))) else /∗The value declaration list is not transformable. ∗/ Not_transformable end, /∗Checks for transformability of a value definfition list.∗/ /∗ Arguments: ======= vdl: the list of value definitions Results: ===== Bool: true if the list is transformable, false otherwise ∗/ CheckValueDefList : ValueDef ∗ × TYPINGS × FUNC × TRANS → Bool CheckValueDefList(vdl, typings, func, trans) ≡ if vdl = 〈〉 then true else CheckValueDef(hd vdl, typings, func, trans) ∧ CheckValueDefList(tl vdl, typings, func, trans) end, 152
C.1. FORMAL SPECIFICATION OF THE TRANSFORMER /∗Checks for transformability of a value definition. ∗/ /∗ Arguments: ======= vd: the value definition Results: ===== Bool: true if the value definition is transformable, false otherwise ∗/ CheckValueDef : ValueDef × TYPINGS × FUNC × TRANS → Bool CheckValueDef(vd, typings, func, trans) ≡ case vd of ExplicitValueDef(st, ve) → if containsTRANSName( Known(type_expr(st)), typings, dom trans) then case binding(st) of IdBinding(id) → let (b, env, types) = CheckValueExpr( ve, Known(type_expr(st)), typings, func, trans, [ ], [ ]) in b end, Make_ProductBinding(pb) → false end else true end, ExplicitFunctionDef(st, ffa, ve, precond) → case type_expr(st) of FunctionTypeExpr(arg, fa, res) → let /∗Establishes ENV and TYPES.∗/ (b1, ffap, env, types, prlet) = TRFormalFuncAppl(ffa, func, trans), (b2, env ′ , types ′ ) = CheckOptPreCondition( precond, Known(TypeLiteral(BOOL)), 153
- Page 118 and 119: CHAPTER 9. IMPLEMENTATION OF THE TR
- Page 120 and 121: CHAPTER 9. IMPLEMENTATION OF THE TR
- Page 122 and 123: CHAPTER 9. IMPLEMENTATION OF THE TR
- Page 124 and 125: CHAPTER 9. IMPLEMENTATION OF THE TR
- Page 126 and 127: CHAPTER 10. EXAMPLES OF TRANSFORMAT
- Page 128 and 129: CHAPTER 10. EXAMPLES OF TRANSFORMAT
- Page 130 and 131: CHAPTER 10. EXAMPLES OF TRANSFORMAT
- Page 132 and 133: CHAPTER 10. EXAMPLES OF TRANSFORMAT
- Page 134 and 135: CHAPTER 10. EXAMPLES OF TRANSFORMAT
- Page 136 and 137: CHAPTER 11. TEST 11.1.1 Lexer and P
- Page 138 and 139: CHAPTER 11. TEST An overview of the
- Page 140 and 141: CHAPTER 12. POSSIBLE EXTENSIONS OF
- Page 142 and 143: CHAPTER 12. POSSIBLE EXTENSIONS OF
- Page 144 and 145: CHAPTER 12. POSSIBLE EXTENSIONS OF
- Page 146 and 147: CHAPTER 13. CONCLUSION RSL AST and
- Page 148 and 149: CHAPTER 13. CONCLUSION 132
- Page 150 and 151: BIBLIOGRAPHY [ST02] Donald Sannello
- 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 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 202 and 203: 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
C.1. FORMAL SPECIFICATION OF THE TRANSFORMER<br />
/∗Checks for transformability <strong>of</strong> a value definition.<br />
∗/<br />
/∗<br />
Arguments:<br />
=======<br />
vd: the value definition<br />
Results:<br />
=====<br />
Bool: true if the value definition is transformable,<br />
false otherwise<br />
∗/<br />
CheckValueDef :<br />
ValueDef × TYPINGS × FUNC × TRANS → Bool<br />
CheckValueDef(vd, typings, func, trans) ≡<br />
case vd <strong>of</strong><br />
ExplicitValueDef(st, ve) →<br />
if<br />
containsTRANSName(<br />
Known(type_expr(st)), typings, dom trans)<br />
then<br />
case binding(st) <strong>of</strong><br />
IdBinding(id) →<br />
let<br />
(b, env, types) =<br />
CheckValueExpr(<br />
ve, Known(type_expr(st)), typings,<br />
func, trans, [ ], [ ])<br />
in<br />
b<br />
end,<br />
Make_ProductBinding(pb) → false<br />
end<br />
else true<br />
end,<br />
ExplicitFunctionDef(st, ffa, ve, precond) →<br />
case type_expr(st) <strong>of</strong><br />
FunctionTypeExpr(arg, fa, res) →<br />
let<br />
/∗Establishes ENV and TYPES.∗/<br />
(b1, ffap, env, types, prlet) =<br />
TRFormalFuncAppl(ffa, func, trans),<br />
(b2, env ′ , types ′ ) =<br />
CheckOptPreCondition(<br />
precond, Known(TypeLiteral(BOOL)),<br />
153