In the expression editor user interface, a set of choices is represented by a list that has one entry for each of the leading terminals of the choice. Whenever the user selects the leading terminal of some element of a choice, the user interface will display a list of all other leading terminals that can occupy that particular place in the expression. Each entry in the list shows the corresponding terminal’s description text, as defined in the grammar.

In our example grammar given above, the leading terminals for a person’s property are name, email and gender. Consequently, when the user selects name, all three of these alternatives will be displayed.

This concept seems trivial, but the set of choices can be determined in complex ways since one can have choices of sequences, or choices of other choices. These are handled as follows:

To demonstrate these principles, let’s modify our example:

<?xcl-stylesheet resource="atg/ui/expreditor/xcl/grammar.xsl"?>
<sequence id="example-sequence">
  <choice id="filter-choice">
    <sequence id="property-filter">
        <token value="name"/>
        <token value="email"/>
        <token value="gender"/>
        <token value="eq"><description>is</description></token>
        <token value="neq"><description>is not</description></token>
    <choice id="location-or-food-choice">
      <sequence id="location-filter">
        <token><description>living in</description></token>
          <token value="US"><description>United States</description></token>
          <token value="JP"><description>Japan</description></token>
      <sequence id="food-filter">
        <token><description>who eat</description></token>
          <token value="meat"/>
          <token value="vegetables"/>

The first element of an expression in this grammar is, of course, People. The second element can be chosen from any of the following:

It is clear enough that whose is a valid choice: after People comes a construct named filter-choice, the first of whose choices is a sequence that begins with the leading terminal whose. The selection of whose automatically includes the other elements of property-filter in the expression—in other words, picking whose includes the entire sequence whose name is ____ in the edited expression.

But note that living in and who eat are presented as alternatives to whose, even though location-filter and food-filter are not direct alternatives to property-filter within the same choice. This occurs because they are elements of location-or-food-choice, which is an alternative to property-filter. The set of alternatives to property-filter must therefore expand to include all the leading terminals of location-or-food-choice.

If the alternative who eat is selected, it alters two different choices in the grammar: the current element of filter-choice becomes location-or-food-choice, and the current element of location-or-food-choice becomes food-filter.