Transformation of Applicative Specifications into Imperative ...
Transformation of Applicative Specifications into Imperative ... Transformation of Applicative Specifications into Imperative ...
APPENDIX C. FORMAL SPECIFICATIONS OF TRANSFORMATIONS Results: ===== VariableDef_list: the resulting variable definition list ∗/ makeVariableDeclList : TRANS → VariableDef ∗ makeVariableDeclList(trans) ≡ if trans = [ ] then 〈〉 else 〈makeVariableDef(hd trans, trans)〉 makeVariableDeclList(trans \ {hd trans}) end, /∗Makes a variable definition from a type name id.∗/ /∗ Arguments: ======= typename: the type name id Results: ===== VariableDef: the resulting variable definition ∗/ makeVariableDef : Id × TRANS → VariableDef makeVariableDef(typename, trans) ≡ SingleVariableDef( trans(typename), TypeName(typename), NoInitialisation), /∗Transforms a type declaration if possible.∗/ /∗ Arguments: ======= tdl: the type declaration Results: ===== DResult: the result of the transformation ∗/ TRTypeDecl : TypeDef ∗ × TYPINGS × FUNC × TRANS → DResult TRTypeDecl(tdl, typings, func, trans) ≡ if CheckTypeDefList(tdl, typings, func, trans) then Transformable(TypeDecl(tdl)) else Not_transformable 146
C.1. FORMAL SPECIFICATION OF THE TRANSFORMER end, /∗Checks for transformability of a type definfition list.∗/ /∗ Arguments: ======= tdl: the list of type definitions Results: ===== Bool: true if the list is transformable, false otherwise ∗/ CheckTypeDefList : TypeDef ∗ × TYPINGS × FUNC × TRANS → Bool CheckTypeDefList(tdl, typings, func, trans) ≡ if tdl = 〈〉 then true else CheckTypeDef(hd tdl, typings, func, trans) ∧ CheckTypeDefList(tl tdl, typings, func, trans) end, /∗Checks for transformability of a type definfition. ∗/ /∗ Arguments: ======= td: the type definition Results: ===== Bool: true if the type definition is transformable, false otherwise ∗/ CheckTypeDef : TypeDef × TYPINGS × FUNC × TRANS → Bool CheckTypeDef(td, typings, func, trans) ≡ case td of SortDef(id) → id ∈ dom trans, VariantDef(id, vl) → CheckVariantList(id, vl, typings, func, trans) ∧ id ∈ elems typings(id), ShortRecordDef(id, cl) → CheckComponentKindList( id, cl, typings, func, trans) ∧ 147
- Page 112 and 113: CHAPTER 8. SPECIFICATIONS the lack
- Page 114 and 115: CHAPTER 9. IMPLEMENTATION OF THE TR
- Page 116 and 117: CHAPTER 9. IMPLEMENTATION OF THE TR
- 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 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 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
APPENDIX C. FORMAL SPECIFICATIONS OF TRANSFORMATIONS<br />
Results:<br />
=====<br />
VariableDef_list: the resulting variable definition<br />
list<br />
∗/<br />
makeVariableDeclList : TRANS → VariableDef ∗<br />
makeVariableDeclList(trans) ≡<br />
if trans = [ ] then 〈〉<br />
else<br />
〈makeVariableDef(hd trans, trans)〉 <br />
makeVariableDeclList(trans \ {hd trans})<br />
end,<br />
/∗Makes a variable definition from a type name<br />
id.∗/<br />
/∗<br />
Arguments:<br />
=======<br />
typename: the type name id<br />
Results:<br />
=====<br />
VariableDef: the resulting variable definition<br />
∗/<br />
makeVariableDef : Id × TRANS → VariableDef<br />
makeVariableDef(typename, trans) ≡<br />
SingleVariableDef(<br />
trans(typename), TypeName(typename),<br />
NoInitialisation),<br />
/∗Transforms a type declaration if possible.∗/<br />
/∗<br />
Arguments:<br />
=======<br />
tdl: the type declaration<br />
Results:<br />
=====<br />
DResult: the result <strong>of</strong> the transformation<br />
∗/<br />
TRTypeDecl :<br />
TypeDef ∗ × TYPINGS × FUNC × TRANS → DResult<br />
TRTypeDecl(tdl, typings, func, trans) ≡<br />
if CheckTypeDefList(tdl, typings, func, trans)<br />
then Transformable(TypeDecl(tdl))<br />
else Not_transformable<br />
146