Transformation of Applicative Specifications into Imperative ...
Transformation of Applicative Specifications into Imperative ... Transformation of Applicative Specifications into Imperative ...
CHAPTER 8. SPECIFICATIONS The rewriting of the specification from RSL to RSL1 requires some changes. The correctness of these changes is discussed in Section 8.5. 8.2 Specification of the RSL AST The specification of the RSL AST RSLAst_Module2.rsl, which can be found in Appendix D, is written in RSL1, such that the specification can be transformed into Java using the RSL2Java tool and thereby be used as part of the transformer. The specification of the RSL AST consists purely of type definitions that are either variant definitions or short record definitions. These type definitions describe the structure of an RSL AST. The specification of the RSL AST is based on the concrete syntax summary of RSL offered in [Gro92, pp. 371-380] and the changes to RSL which can be found in [Gro95]. The construction of the RSL AST is straight forward when following these syntax summaries. In RSL graphical symbols like parenthesizes and commas are used to distinguish between the different kinds of RSL constructs. When the type of an RSL construct is determined these symbols are superfluous and can be discarded. This is exploited in the specification of the RSL AST where only the necessary information is kept. Otherwise the syntax of RSL consists of terminals T and nonterminals NT. Terminals are indivisible entities, whereas nonterminals are symbols that can be expressed in terms of other symbols, terminals or nonterminals. The relationship between the RSL syntax and the RSL AST specification is described in the following. Syntax of the form becomes whereas becomes NT ::= NT1 . . . NTn NT :: nt1 : NT1 . . . ntn : NTn NT ::= NT1| . . . |NTn NT1 ::= NT11 . . . NT1n . NTn ::= NTn1 . . . NTnn 72
NT == 8.2. SPECIFICATION OF THE RSL AST NT1(nt11 : NT11 ... nt1n : NT1n) | . NTn(ntn1 : NTn1 ... ntnn : NTnn), NT11 :: . . ., . NTnn :: . . . When the alternatives are terminals as in it is specified as NT ::= T1| . . . |Tn NT == T1 | . . . | Tn An example of some RSL syntax and the corresponding RSL AST specification can be found in Example 8.1. Example 8.1 – Specification of the RSL AST based on the syntax of RSL RSL syntax: value_expr ::= value_or_variable − name | name ::= id product_expr | infix_expr product_expr ::= (value_expr−list) infix_expr ::= value_expr infix_op value_expr infix_op ::= + | − | = 73
- Page 38 and 39: CHAPTER 4. CONSTRAINTS of interest.
- Page 40 and 41: CHAPTER 4. CONSTRAINTS 24
- Page 42 and 43: CHAPTER 5. TRANSFORMABILITY scheme
- Page 44 and 45: CHAPTER 5. TRANSFORMABILITY 28
- Page 46 and 47: CHAPTER 6. TRANSFORMATIONS 6.2.1 Tr
- Page 48 and 49: CHAPTER 6. TRANSFORMATIONS Example
- Page 50 and 51: CHAPTER 6. TRANSFORMATIONS Applicat
- Page 52 and 53: CHAPTER 6. TRANSFORMATIONS object A
- Page 54 and 55: CHAPTER 6. TRANSFORMATIONS type T =
- Page 56 and 57: CHAPTER 6. TRANSFORMATIONS where ge
- Page 58 and 59: CHAPTER 6. TRANSFORMATIONS Ranged s
- Page 60 and 61: CHAPTER 6. TRANSFORMATIONS ✄ end
- Page 62 and 63: CHAPTER 6. TRANSFORMATIONS Value In
- 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 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 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
NT ==<br />
8.2. SPECIFICATION OF THE RSL AST<br />
NT1(nt11 : NT11 ... nt1n : NT1n) |<br />
.<br />
NTn(ntn1 : NTn1 ... ntnn : NTnn),<br />
NT11 :: . . .,<br />
.<br />
NTnn :: . . .<br />
When the alternatives are terminals as in<br />
it is specified as<br />
NT ::= T1| . . . |Tn<br />
NT == T1 | . . . | Tn<br />
An example <strong>of</strong> some RSL syntax and the corresponding RSL AST specification<br />
can be found in Example 8.1.<br />
Example 8.1 – Specification <strong>of</strong> the RSL AST based on the syntax <strong>of</strong> RSL<br />
RSL syntax:<br />
value_expr ::= value_or_variable − name |<br />
name ::= id<br />
product_expr |<br />
infix_expr<br />
product_expr ::= (value_expr−list)<br />
infix_expr ::= value_expr infix_op value_expr<br />
infix_op ::= + |<br />
− |<br />
=<br />
73