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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 6. TRANSFORMATIONS<br />

type<br />

T = Int<br />

variable<br />

t : T<br />

value<br />

obsgen : Unit → read t write t Unit<br />

obsgen() ≡ t := t + 1<br />

<strong>Transformation</strong> <strong>of</strong> the Different Value Expressions<br />

In the following the transformations <strong>of</strong> the different value expressions <strong>of</strong><br />

RSLA are given.<br />

Value Literals<br />

The transformation <strong>of</strong> value literals is straight forward as they have to be<br />

transformed within the same language, namely RSL. This means that a value<br />

literal is transformed <strong>into</strong> itself.<br />

Value Names<br />

A value name, i.e. either the id <strong>of</strong> a value declaration, the id <strong>of</strong> a let binding or<br />

a formal parameter <strong>of</strong> a function definition, is transformed <strong>into</strong> itself except<br />

when it is <strong>of</strong> the type <strong>of</strong> interest. In that case it is either transformed <strong>into</strong><br />

the variable name <strong>of</strong> the type <strong>of</strong> interest or, if it is a constant <strong>of</strong> the type <strong>of</strong><br />

interest, it is transformed as an application expression taking no parameters.<br />

Basic Expressions<br />

When dealing with basic expressions it is only necessary to deal with chaos<br />

as the other basic expressions not are part <strong>of</strong> RSLA. chaos is transformed<br />

<strong>into</strong> itself.<br />

Product Expressions<br />

A product expression has the following form:<br />

(value_expr1, value_expr2, ..., value_exprn)<br />

A product expression is transformed by transforming the constituent<br />

value expressions one by one, as in Example 6.7.<br />

38

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

Saved successfully!

Ooh no, something went wrong!