Transformation of Applicative Specifications into Imperative ...

Transformation of Applicative Specifications into Imperative ... Transformation of Applicative Specifications into Imperative ...

26.09.2013 Views

APPENDIX D. SPECIFICATION OF TRANSFORMER IN RSL1 BOOL_ENV_TYPES CheckCaseBranchList( cbl, et, typings, func, trans, env, types) ≡ if cbl = 〈〉 then mk_BOOL_ENV_TYPES(true, env, types) else if and( bool( CheckPattern( pattern(hd cbl), func, trans, env, types )), bool( CheckValueExpr( value_expr(hd cbl), et, typings, func, trans, envMap( CheckPattern( pattern(hd cbl), func, trans, env, types)), typesMap( CheckPattern( pattern(hd cbl), func, trans, env, types))))) then CheckCaseBranchList( tl cbl, et, typings, func, trans, envMap( CheckPattern( pattern(hd cbl), func, trans, env, types )), typesMap( CheckValueExpr( value_expr(hd cbl), et, typings, func, trans, envMap( CheckPattern( pattern(hd cbl), func, trans, env, types)), typesMap( CheckPattern( pattern(hd cbl), func, trans, env, types))))) else 352

D.2. FORMAL SPECIFICATION OF THE TRANSFORMER IN RSL1 mk_BOOL_ENV_TYPES( false, envMap( CheckPattern( pattern(hd cbl), func, trans, env, types )), typesMap( CheckValueExpr( value_expr(hd cbl), et, typings, func, trans, envMap( CheckPattern( pattern(hd cbl), func, trans, env, types)), typesMap( CheckPattern( pattern(hd cbl), func, trans, env, types))))) end end, CheckPattern : Pattern × FUNC × TRANS × ENV × TYPES → BOOL_ENV_TYPES CheckPattern(p, func, trans, env, types) ≡ case p of ValueLiteralPattern(vl) → mk_BOOL_ENV_TYPES(true, env, types), NamePattern(id, optid) → if isinId(id, domainFUNC(func)) then mk_BOOL_ENV_TYPES(false, env, types) else if not( isinBinding( IdBinding(id), domainTYPES(types))) then mk_BOOL_ENV_TYPES(true, env, types) else if checkTRANS( getMapValueTYPES(types, IdBinding(id)), domainTRANS(trans)) then /∗The value expression is of the type of interest. 353

APPENDIX D. SPECIFICATION OF TRANSFORMER IN RSL1<br />

BOOL_ENV_TYPES<br />

CheckCaseBranchList(<br />

cbl, et, typings, func, trans, env, types) ≡<br />

if cbl = 〈〉<br />

then mk_BOOL_ENV_TYPES(true, env, types)<br />

else<br />

if<br />

and(<br />

bool(<br />

CheckPattern(<br />

pattern(hd cbl), func, trans, env, types<br />

)),<br />

bool(<br />

CheckValueExpr(<br />

value_expr(hd cbl), et, typings, func,<br />

trans,<br />

envMap(<br />

CheckPattern(<br />

pattern(hd cbl), func, trans,<br />

env, types)),<br />

typesMap(<br />

CheckPattern(<br />

pattern(hd cbl), func, trans,<br />

env, types)))))<br />

then<br />

CheckCaseBranchList(<br />

tl cbl, et, typings, func, trans,<br />

envMap(<br />

CheckPattern(<br />

pattern(hd cbl), func, trans, env, types<br />

)),<br />

typesMap(<br />

CheckValueExpr(<br />

value_expr(hd cbl), et, typings, func,<br />

trans,<br />

envMap(<br />

CheckPattern(<br />

pattern(hd cbl), func, trans,<br />

env, types)),<br />

typesMap(<br />

CheckPattern(<br />

pattern(hd cbl), func, trans,<br />

env, types)))))<br />

else<br />

352

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

Saved successfully!

Ooh no, something went wrong!