26.09.2013 Views

Transformation of Applicative Specifications into Imperative ...

Transformation of Applicative Specifications into Imperative ...

Transformation of Applicative Specifications into Imperative ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 8. SPECIFICATIONS<br />

The rewriting <strong>of</strong> the specification from RSL to RSL1 requires some changes.<br />

The correctness <strong>of</strong> these changes is discussed in Section 8.5.<br />

8.2 Specification <strong>of</strong> the RSL AST<br />

The specification <strong>of</strong> the RSL AST RSLAst_Module2.rsl, which can be found<br />

in Appendix D, is written in RSL1, such that the specification can be transformed<br />

<strong>into</strong> Java using the RSL2Java tool and thereby be used as part <strong>of</strong><br />

the transformer.<br />

The specification <strong>of</strong> the RSL AST consists purely <strong>of</strong> type definitions<br />

that are either variant definitions or short record definitions. These type<br />

definitions describe the structure <strong>of</strong> an RSL AST. The specification <strong>of</strong> the<br />

RSL AST is based on the concrete syntax summary <strong>of</strong> RSL <strong>of</strong>fered in [Gro92,<br />

pp. 371-380] and the changes to RSL which can be found in [Gro95]. The<br />

construction <strong>of</strong> the RSL AST is straight forward when following these syntax<br />

summaries.<br />

In RSL graphical symbols like parenthesizes and commas are used to<br />

distinguish between the different kinds <strong>of</strong> RSL constructs. When the type<br />

<strong>of</strong> an RSL construct is determined these symbols are superfluous and can be<br />

discarded. This is exploited in the specification <strong>of</strong> the RSL AST where only<br />

the necessary information is kept.<br />

Otherwise the syntax <strong>of</strong> RSL consists <strong>of</strong> terminals T and nonterminals<br />

NT. Terminals are indivisible entities, whereas nonterminals are symbols<br />

that can be expressed in terms <strong>of</strong> other symbols, terminals or nonterminals.<br />

The relationship between the RSL syntax and the RSL AST specification<br />

is described in the following.<br />

Syntax <strong>of</strong> the form<br />

becomes<br />

whereas<br />

becomes<br />

NT ::= NT1 . . . NTn<br />

NT :: nt1 : NT1 . . . ntn : NTn<br />

NT ::= NT1| . . . |NTn<br />

NT1 ::= NT11 . . . NT1n<br />

.<br />

NTn ::= NTn1 . . . NTnn<br />

72

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!