next up previous contents
Next: Block Up: Evaluation Rules Previous: Binding   Contents

Select

<

Select     ::= Primary Selector GenArc
Selector   ::= Delim | !
GenArc     ::= Arc | $ Id | $ ( Expr ) | % Expr %
Arc        ::= Id | Integer | Text

A Select expression denotes a selection from a binding, so the Primary must evaluate to a binding value.

<

Primary Selector % Expr % desugars to Primary Selector $ ( Expr )

<

The Delim syntax selects a value out of a binding by name.

Eval( Primary Delim Arc , C) =
  _lookup(Eval( Primary , C), id)

Here id is the t_text value of Arc, as defined in Section A.3.3.5 above.

The $(Expr) syntax allows the selected name to be computed:

Eval( Primary Delim $ ( Expr ) , C) =
  _lookup(Eval( Primary , C), Eval( Expr , C))

The ! syntax tests whether a name is in a binding's domain:

Eval( Primary ! Id , C) =
  _defined(Eval( Primary , C), id),

As defined in Section A.3.4.5, _defined(b, nm) evaluates to true if nm is non-empty and in b's domain, and to false otherwise. As above, the $(Expr) syntax can be used to compute the name:

Eval( Primary ! $ ( Expr ) , C) =
  _defined(Eval( Primary , C), Eval( Expr , C))

In both cases where the GenArc is a computed expression, the Expr must evaluate to a t_text.



Allan Heydon, Roy Levin, Timothy Mann, Yuan Yu