Transformation of Applicative Specifications into Imperative ...
Transformation of Applicative Specifications into Imperative ... Transformation of Applicative Specifications into Imperative ...
CHAPTER 9. IMPLEMENTATION OF THE TRANSFORMER 9.2 Exploiting the RSL2Java Tool The idea behind basing the implementation of the transformer on the RSL2Java tool is to be able to reuse some of the more or less tedious work done in [Hja04] in order to focus on the more interesting parts of the transformer. The way to exploit the RSL2Java tool is described in the following using tombstone diagrams as described in [WB00]. First an RSL specification of the transformation from an RSL AST of an applicative specification, named RSLA AST, into an RSL AST of an imperative RSL specification, named RSLI AST, is written within RSL1. Then this specification is translated into Java using the RSL2Java tool, see Figure 9.1. The resulting Java program is combined with an extended version of the RSL2Java tool front end and a revised version of the RSL AST to RSL unparser provided by the RSL2Java tool, Figure 9.2. The result is a Java program, which can do the desired transformation from applicative RSL specifications into imperative RSL specifications, see Figure 9.3 on the next page. RSL A transformer specification RSL A AST RSL I AST RSL 1 RSL 1 Java RSL2Java tool RSL AST transformer RSL A AST RSL I AST Java Java Figure 9.1: Translating the specification of the transformer extended front end RSL AST transformer new back end RSL AST RSL AST RSL AST RSL AST A A I I Java Java Java Figure 9.2: Combining the 3 parts 98 RSL I
RSL A transformer Java 9.3. DEVELOPMENT PROCESS RSL I Figure 9.3: The resulting transformer 9.3 Development Process Besides having to write the RSL specification of the transformation, some changes must be applied to the RSL2Java tool, since it only works for RSL1. The transformer has to be able to translate a different subset RSLA of RSL into yet another RSL subset RSLI. The relationships between the three subsets are illustrated in Figure 9.4. RSL I RSL A RSL 1 Figure 9.4: The different subsets of RSL In the following I will describe the different steps in the process of developing the transformer by changing the RSL2Java tool. 9.3.1 Front End The front end, which is developed using the ANTLR tool, [Par], must be extended and in some cases altered in order to be able to parse RSLA. This means extending and altering the grammar file rsltorslast.g from which the lexer and parser are generated and then generate the actual lexer and parser. 99
- Page 64 and 65: CHAPTER 6. TRANSFORMATIONS ✄ sche
- Page 66 and 67: CHAPTER 6. TRANSFORMATIONS A case e
- Page 68 and 69: CHAPTER 6. TRANSFORMATIONS is due t
- Page 70 and 71: CHAPTER 6. TRANSFORMATIONS 6.4.4 Tr
- Page 72 and 73: CHAPTER 6. TRANSFORMATIONS 56
- Page 74 and 75: CHAPTER 7. CORRECTNESS OF TRANSFORM
- Page 76 and 77: CHAPTER 7. CORRECTNESS OF TRANSFORM
- Page 78 and 79: CHAPTER 7. CORRECTNESS OF TRANSFORM
- Page 80 and 81: CHAPTER 7. CORRECTNESS OF TRANSFORM
- Page 82 and 83: CHAPTER 7. CORRECTNESS OF TRANSFORM
- Page 84 and 85: CHAPTER 7. CORRECTNESS OF TRANSFORM
- Page 86 and 87: CHAPTER 7. CORRECTNESS OF TRANSFORM
- Page 88 and 89: CHAPTER 8. SPECIFICATIONS The rewri
- Page 90 and 91: CHAPTER 8. SPECIFICATIONS RSL speci
- Page 92 and 93: CHAPTER 8. SPECIFICATIONS The FUNC
- Page 94 and 95: CHAPTER 8. SPECIFICATIONS out, that
- Page 96 and 97: CHAPTER 8. SPECIFICATIONS construct
- Page 98 and 99: CHAPTER 8. SPECIFICATIONS 8.4.1 Mor
- Page 100 and 101: CHAPTER 8. SPECIFICATIONS PRECOND_T
- Page 102 and 103: CHAPTER 8. SPECIFICATIONS if length
- Page 104 and 105: CHAPTER 8. SPECIFICATIONS subtypes.
- Page 106 and 107: CHAPTER 8. SPECIFICATIONS 8.5.2 Cha
- Page 108 and 109: CHAPTER 8. SPECIFICATIONS axiom [ m
- Page 110 and 111: CHAPTER 8. SPECIFICATIONS Specifica
- Page 112 and 113: CHAPTER 8. SPECIFICATIONS the lack
- 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 162 and 163: APPENDIX C. FORMAL SPECIFICATIONS O
CHAPTER 9. IMPLEMENTATION OF THE TRANSFORMER<br />
9.2 Exploiting the RSL2Java Tool<br />
The idea behind basing the implementation <strong>of</strong> the transformer on the RSL2Java<br />
tool is to be able to reuse some <strong>of</strong> the more or less tedious work done in<br />
[Hja04] in order to focus on the more interesting parts <strong>of</strong> the transformer.<br />
The way to exploit the RSL2Java tool is described in the following using<br />
tombstone diagrams as described in [WB00].<br />
First an RSL specification <strong>of</strong> the transformation from an RSL AST <strong>of</strong><br />
an applicative specification, named RSLA AST, <strong>into</strong> an RSL AST <strong>of</strong> an<br />
imperative RSL specification, named RSLI AST, is written within RSL1.<br />
Then this specification is translated <strong>into</strong> Java using the RSL2Java tool, see<br />
Figure 9.1. The resulting Java program is combined with an extended version<br />
<strong>of</strong> the RSL2Java tool front end and a revised version <strong>of</strong> the RSL AST to RSL<br />
unparser provided by the RSL2Java tool, Figure 9.2. The result is a Java<br />
program, which can do the desired transformation from applicative RSL<br />
specifications <strong>into</strong> imperative RSL specifications, see Figure 9.3 on the next<br />
page.<br />
RSL A<br />
transformer specification<br />
RSL A AST RSL I AST<br />
RSL 1<br />
RSL 1<br />
Java<br />
RSL2Java<br />
tool<br />
RSL AST transformer<br />
RSL A AST RSL I AST<br />
Java<br />
Java<br />
Figure 9.1: Translating the specification <strong>of</strong> the transformer<br />
extended front end RSL AST transformer new back end<br />
RSL AST RSL AST RSL AST RSL AST<br />
A A I I<br />
Java Java Java<br />
Figure 9.2: Combining the 3 parts<br />
98<br />
RSL I