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 6. TRANSFORMATIONS<br />

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

expressions and patterns.<br />

The patterns are transformed as follows:<br />

Value Literal Pattern<br />

A value literal pattern is transformed <strong>into</strong> itself.<br />

Name Pattern<br />

A name pattern is transformed <strong>into</strong> itself unless if it is <strong>of</strong> the type <strong>of</strong> interest.<br />

In that case the specification cannot be transformed as a pattern cannot<br />

consist <strong>of</strong> a variable.<br />

Wildcard Pattern<br />

A wildcard pattern is transformed <strong>into</strong> itself.<br />

Product Pattern<br />

A product pattern is <strong>of</strong> the form:<br />

(pattern1, pattern2, ..., patternn)<br />

A product pattern is transformed by transforming the constituent patterns.<br />

Record Pattern<br />

A record pattern is <strong>of</strong> the form:<br />

id(pattern1, pattern2, ..., patternn)<br />

A record pattern is transformed by transforming the constituent patterns.<br />

List Pattern<br />

A list pattern is <strong>of</strong> one <strong>of</strong> the forms:<br />

〈pattern1, pattern2, ..., patternn〉<br />

〈pattern1, pattern2, ..., patternn〉 patternn+1<br />

A list pattern is transformed by transforming the constituent patterns.<br />

Introducing Assignment Expressions<br />

When transforming an applicative specification <strong>into</strong> the imperative counterpart<br />

it is necessary to establish assignment expressions when the value <strong>of</strong> the<br />

variable <strong>of</strong> the type <strong>of</strong> interest must be changed. This can happen in two<br />

situations.<br />

When dealing with a generator <strong>of</strong> the form:<br />

50

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

Saved successfully!

Ooh no, something went wrong!