Transformation of Applicative Specifications into Imperative ...
Transformation of Applicative Specifications into Imperative ... Transformation of Applicative Specifications into Imperative ...
APPENDIX D. SPECIFICATION OF TRANSFORMER IN RSL1 BracketedTypeExpr(bte) → getTOIReturnsListTN(bte, trans) end, getTOIReturnsListProductTN : TypeExpr ∗ × TRANS → Access ∗ getTOIReturnsListProductTN(tel, trans) ≡ if tel = 〈〉 then 〈〉 else getTOIReturnsListTN(hd tel, trans) getTOIReturnsListProductTN(tl tel, trans) end, /∗**** Generators and observers end ****∗/ /∗**** Access ****∗/ makeReadAccessDesc : Access ∗ × TRANS → OptionalReadAccessDesc makeReadAccessDesc(al, trans) ≡ if al = 〈〉 then NoReadAccessMode else ReadAccessDesc(toVariableList(al, trans)) end, makeWriteAccessDesc : Access ∗ × TRANS → OptionalWriteAccessDesc makeWriteAccessDesc(rs, trans) ≡ if rs = 〈〉 then NoWriteAccessMode else WriteAccessDesc(toVariableList(rs, trans)) end, toVariableList : Access ∗ × TRANS → Access ∗ toVariableList(al, trans) ≡ if al = 〈〉 then al else case hd al of AccessValueOrVariableName(vn) → if isinId(id(vn), domainTRANS(trans)) then 〈AccessValueOrVariableName( mk_ValueOrVariableName( getMapValueTRANS(trans, id(vn))))〉 toVariableList(tl al, trans) else toVariableList(tl al, trans) 422
D.2. FORMAL SPECIFICATION OF THE TRANSFORMER IN RSL1 end end, end removeDuplets : Access ∗ → Access ∗ removeDuplets(al) ≡ if lengthAccess(al) = lengthAccess(elementsAccess(al)) then al else if isinAccess(hd al, elementsAccess(tl al)) then removeDuplets(tl al) else 〈hd al〉 removeDuplets(tl al) end end, getAccess : TypeExpr × TRANS → Access ∗ getAccess(te, trans) ≡ case te of TypeLiteral(literal) → 〈〉, TypeName(id) → if isinId(id, domainTRANS(trans)) then /∗Type of interest.∗/ 〈AccessValueOrVariableName( mk_ValueOrVariableName(id))〉 else /∗Not type of interest.∗/ 〈〉 end, TypeExprProduct(tep) → getAccessList(tep, trans), TypeExprSet(tes) → 〈〉, TypeExprList(tel) → 〈〉, TypeExprMap(tem) → 〈〉, FunctionTypeExpr(arg, fa, res) → 〈〉, BracketedTypeExpr(bte) → getAccess(bte, trans) end, getAccessList : TypeExpr ∗ × TRANS → Access ∗ getAccessList(tel, trans) ≡ if tel = 〈〉 then 〈〉 else getAccess(hd tel, trans) 423
- Page 388 and 389: APPENDIX D. SPECIFICATION OF TRANSF
- Page 390 and 391: APPENDIX D. SPECIFICATION OF TRANSF
- Page 392 and 393: APPENDIX D. SPECIFICATION OF TRANSF
- Page 394 and 395: APPENDIX D. SPECIFICATION OF TRANSF
- Page 396 and 397: APPENDIX D. SPECIFICATION OF TRANSF
- Page 398 and 399: APPENDIX D. SPECIFICATION OF TRANSF
- Page 400 and 401: APPENDIX D. SPECIFICATION OF TRANSF
- Page 402 and 403: APPENDIX D. SPECIFICATION OF TRANSF
- Page 404 and 405: APPENDIX D. SPECIFICATION OF TRANSF
- Page 406 and 407: APPENDIX D. SPECIFICATION OF TRANSF
- Page 408 and 409: APPENDIX D. SPECIFICATION OF TRANSF
- Page 410 and 411: APPENDIX D. SPECIFICATION OF TRANSF
- Page 412 and 413: APPENDIX D. SPECIFICATION OF TRANSF
- Page 414 and 415: APPENDIX D. SPECIFICATION OF TRANSF
- Page 416 and 417: APPENDIX D. SPECIFICATION OF TRANSF
- Page 418 and 419: APPENDIX D. SPECIFICATION OF TRANSF
- Page 420 and 421: APPENDIX D. SPECIFICATION OF TRANSF
- Page 422 and 423: APPENDIX D. SPECIFICATION OF TRANSF
- Page 424 and 425: APPENDIX D. SPECIFICATION OF TRANSF
- Page 426 and 427: APPENDIX D. SPECIFICATION OF TRANSF
- Page 428 and 429: APPENDIX D. SPECIFICATION OF TRANSF
- Page 430 and 431: APPENDIX D. SPECIFICATION OF TRANSF
- Page 432 and 433: APPENDIX D. SPECIFICATION OF TRANSF
- Page 434 and 435: APPENDIX D. SPECIFICATION OF TRANSF
- Page 436 and 437: APPENDIX D. SPECIFICATION OF TRANSF
- Page 440 and 441: APPENDIX D. SPECIFICATION OF TRANSF
- Page 442 and 443: APPENDIX D. SPECIFICATION OF TRANSF
- Page 444 and 445: APPENDIX D. SPECIFICATION OF TRANSF
- Page 446 and 447: APPENDIX D. SPECIFICATION OF TRANSF
- Page 448 and 449: APPENDIX D. SPECIFICATION OF TRANSF
- Page 450 and 451: APPENDIX D. SPECIFICATION OF TRANSF
- Page 452 and 453: APPENDIX D. SPECIFICATION OF TRANSF
- Page 454 and 455: APPENDIX D. SPECIFICATION OF TRANSF
- Page 456 and 457: APPENDIX D. SPECIFICATION OF TRANSF
- Page 458 and 459: APPENDIX D. SPECIFICATION OF TRANSF
- Page 460 and 461: APPENDIX D. SPECIFICATION OF TRANSF
- Page 462 and 463: APPENDIX D. SPECIFICATION OF TRANSF
- Page 464 and 465: APPENDIX D. SPECIFICATION OF TRANSF
- Page 466 and 467: APPENDIX D. SPECIFICATION OF TRANSF
- Page 468 and 469: APPENDIX D. SPECIFICATION OF TRANSF
- Page 470 and 471: APPENDIX D. SPECIFICATION OF TRANSF
- Page 472 and 473: APPENDIX D. SPECIFICATION OF TRANSF
- Page 474 and 475: APPENDIX D. SPECIFICATION OF TRANSF
- Page 476 and 477: APPENDIX D. SPECIFICATION OF TRANSF
- Page 478 and 479: APPENDIX D. SPECIFICATION OF TRANSF
- Page 480 and 481: APPENDIX D. SPECIFICATION OF TRANSF
- Page 482 and 483: APPENDIX D. SPECIFICATION OF TRANSF
- Page 484 and 485: APPENDIX D. SPECIFICATION OF TRANSF
- Page 486 and 487: APPENDIX D. SPECIFICATION OF TRANSF
D.2. FORMAL SPECIFICATION OF THE TRANSFORMER IN RSL1<br />
end<br />
end,<br />
end<br />
removeDuplets : Access ∗ → Access ∗<br />
removeDuplets(al) ≡<br />
if<br />
lengthAccess(al) =<br />
lengthAccess(elementsAccess(al))<br />
then al<br />
else<br />
if isinAccess(hd al, elementsAccess(tl al))<br />
then removeDuplets(tl al)<br />
else 〈hd al〉 removeDuplets(tl al)<br />
end<br />
end,<br />
getAccess : TypeExpr × TRANS → Access ∗<br />
getAccess(te, trans) ≡<br />
case te <strong>of</strong><br />
TypeLiteral(literal) → 〈〉,<br />
TypeName(id) →<br />
if isinId(id, domainTRANS(trans))<br />
then<br />
/∗Type <strong>of</strong> interest.∗/<br />
〈AccessValueOrVariableName(<br />
mk_ValueOrVariableName(id))〉<br />
else<br />
/∗Not type <strong>of</strong> interest.∗/<br />
〈〉<br />
end,<br />
TypeExprProduct(tep) → getAccessList(tep, trans),<br />
TypeExprSet(tes) → 〈〉,<br />
TypeExprList(tel) → 〈〉,<br />
TypeExprMap(tem) → 〈〉,<br />
FunctionTypeExpr(arg, fa, res) → 〈〉,<br />
BracketedTypeExpr(bte) → getAccess(bte, trans)<br />
end,<br />
getAccessList : TypeExpr ∗ × TRANS → Access ∗<br />
getAccessList(tel, trans) ≡<br />
if tel = 〈〉 then 〈〉<br />
else<br />
getAccess(hd tel, trans) <br />
423