9.6 Type expressions9.6 Type expressions
9 SML translator 9 SML translator
9.7 Value expressions

9.7 Value expressions

9.7.1 Value literals

The RSL value literals are accepted.

9.7.2 Names

A value name translates as a name.

9.7.3 Pre names

Not accepted.

9.7.4 Basic expressions

The only basic expression in RSLSML is skip.

9.7.5 Product expressions

A product expression translates to an SML product expression.

9.7.6 Set expressions

Enumerated and ranged set expressions are accepted.

A comprehended set expression can only be translated if it takes one of the forms

                                     
 { e | b : T • b ∈ slm }
 or
 { e | b : T • b ∈ slm /\ p }

where b is a binding, T is a type, e is a translatable expression, slm is a translatable expression of set, list, or map type, and p is a translatable expression of type Bool.

9.7.7 List expressions

Enumerated and ranged list expressions are accepted.

A comprehended list expression can only be translated if it takes one of the forms

                                     
 〈 e | b in l 〉
 or
 〈 e | b in l • p 〉

where b is a binding, e is a translatable expression, l is a translatable expression of list type, and p is a translatable expression of type Bool.

9.7.8 Map expressions

Enumerated map expressions are accepted.

A comprehended map expression can only be translated if it takes one of the forms

                                     
 [ e1 ↦ e2 | b :T • b ∈ slm ]
 or
 [ e1 ↦ e2 | b :T • b ∈ slm /\ p]

where b is a binding, e1 and e2 are translatable expressions, T is a type, slm is a translatable expression of set, list, or map type, and p is a translatable expression of type Bool.

9.7.9 Function expressions

Function expressions are accepted.

9.7.10 Application expressions

An application expression may be translated to a function call, a list application or a map application.

9.7.11 Quantified expressions

Quantified expressions can only be translated if they take one of the following forms:
                                     
 ∀ b : T • b ∈ slm
 ∀ b : T • b ∈ slm ⇒ p
 ∀ b : T • b ∈ slm /\ p ⇒ q
 ∃ b : T • b ∈ slm
 ∃ b : T • b ∈ slm /\ p
 ∃! b : T • b ∈ slm
 ∃! b : T • b ∈ slm /\ p

where b is a binding, T is a type, slm is a translatable expression of set, list or map type, and p and q are translatable expressions of type Bool.

9.7.12 Equivalence expressions

Not accepted.

9.7.13 Post expressions

Not accepted.

9.7.14 Disambiguation expressions

A disambiguation expression translates as its constituent value expression.

9.7.15 Bracketed expressions

A bracketed expression translates to a bracketed expression.

9.7.16 Infix expressions

An infix expression translates to the corresponding SML expression.

9.7.17 Prefix expressions

A prefix expression translates to the corresponding SML expression.

A universal prefix expression (□) is not accepted.

9.7.18 Initialise expressions

Not accepted.

9.7.19 Assignment expressions

An assignment expression translates to an assignment expression.

9.7.20 Input expressions

Not accepted.

9.7.21 Output expressions

Not accepted.

9.7.22 Local expressions

Local expressions are accepted.

9.7.23 Let expressions

Explicit let expressions are accepted, subject to the restrictions on patterns listed in section 9.7.25.

An implicit let expression can only be translated if it has one of the forms

                                     
 let b : T • b ∈ slm in ... end
 or
 let b : T • b ∈ slm /\ p in ... end

where b is a binding, T a type, slm a translatable expression of set, list, or map type, and p a translatable expression of type Bool.

9.7.24 If expressions

An if expression translates to an if expression.

9.7.25 Case expressions

Case expressions are accepted subject to some restrictions on possible patterns when the case is over a variant or record type and involves a function constructor:

9.7.26 While expressions

While expressions are accepted.

9.7.27 Until expressions

Until expressions are accepted.

9.7.28 For expressions

For expressions are accepted.
Chris George, April 17, 2008

9.7 Value expressions
9.6 Type expressions9.6 Type expressions
9 SML translator 9 SML translator