Next: , Previous: IL syntax, Up: Compiler


4.13 SL syntax

In this section, we describe how to transform Intermediate Language (IL) expressions into Solver Language (SL) expressions which are used in the XDK solver.

4.13.1 Feature path

Here is the syntax of IL feature paths:

     elem(tag: featurepath
          root: RootA
          dimension: VIL
          dimension_idref: IDA
          aspect: AspectA
          fields: FieldCILs)

RootA is an Oz atom corresponding to the root variable, VIL is an IL variable corresponding to the dimension variable, IDA is an Oz atom corresponding to the dimension identifier, AspectA is an Oz atom corresponding to the aspect, and FieldCILs is a list of IL constants corresponding to the fields of the feature path.

And here is the corresponding SL expression:

     featurepath(root: RootA
                 dimension: DVA
                 dimension_idref: IDA
                 aspect: AspectA
                 fields: FieldAs)

RootA, IDA and AspectA stay the same. DVA is an Oz atom corresponding to VIL, and FieldAs is a list of Oz atoms corresponding to FieldCILs.

4.13.2 Cardinality set

Here is the syntax of IL cardinalities:

     elem(tag: 'card.wild'
          arg: IL)
     
     elem(tag: 'card.set'
          args: IILs)
     
     elem(tag: 'card.interval'
          arg1: IIL1
          arg2: IIL2)

And here is the corresponding SL expression:

     M

where M is the Oz finite set encoding the cardinality.

4.13.3 Domain

Here is the syntax of IL constants:

     elem(tag: constant
          data: A)

A is an Oz atom corresponding to the constant itself.

And here is the corresponding SL expression:

     I

I is an Oz integer encoding A.

4.13.4 Integer

Here is the syntax of IL integers:

     elem(tag: integer
          data: I)

I is an Oz integer corresponding to the integer.

And here is the corresponding SL expression:

     I

I stays the same.

4.13.5 List

Here is the syntax of IL lists:

     elem(tag: list
          args: ILs)

ILs is an Oz list of IL expressions.

And here is the corresponding SL expression:

     SLs

SLs is an Oz list of SL expressions encoding ILs.

4.13.6 Record

Here is the syntax of IL records:

     elem(tag: record
          args: [CIL1#IL1
                 ...
                 CILn#ILn])

The value of the args feature is a list of pairs CILi#ILi of an IL constant and an IL expression (1<=i<=n).

And here is the corresponding SL expression:

     o(A1:SL1
       ...
       An:SLn)

Ai is the Oz atom encoding CILi, and SLi the SL expression encoding ILi (1<=i<=n).

4.13.7 Set

Here is the syntax of IL sets:

     elem(tag: set
          args: ILs)

ILs is an Oz list of IL expressions.

The corresponding SL expression is different depending on the type of the domain of the set:

  1. a finite domain of constants or a tuple whose projections are all finite domains of constants
  2. integer
  3. any other type
  1. Here is the corresponding SL expression:
              M
         

    M is an Oz finite set of integers encoding the constants in the set.

  2. See 1.
  3. Here is the corresponding SL expression:
              SLs
         

    SLs is an Oz list of SL expressions encoding ILs.

4.13.8 Order

Here is the syntax of order generators:

     elem(tag: order
          args: ILs)

ILs is an Oz list of IL expressions.

The corresponding SL expression is the encoding of the set of all tuples representing the order relation described by ILs. For instance, the encoding of:

     elem(tag: order
          args: [elem(tag: constant
                      data: a)
                 elem(tag: constant
                      data: b)
                 elem(tag: constant
                      data: c)])

is:

     elem(tag: set
          args: [elem(tag: list
                      args: [elem(tag: constant
                                  data: a)
                             elem(tag: constant
                                  data: b)])
                 elem(tag: list
                      args: [elem(tag: constant
                                  data: a)
                             elem(tag: constant
                                  data: c)])
                 elem(tag: list
                      args: [elem(tag: constant
                                  data: b)
                             elem(tag: constant
                                  data: c)])])

4.13.9 String

Here is the syntax of IL strings:

     elem(tag: constant
          data: A)

A is an Oz atom corresponding to the string.

And here is the corresponding SL expression:

     A

A stays the same.

4.13.10 Concat

Here is the syntax of concatenation:

     elem(tag: concat
          args: ILs)

ILs is an Oz list of IL expressions.

The corresponding SL expression is the concatenation of the IL expressions ILs. Concatenation is restricted to strings.

4.13.11 Tuple

Here is the syntax of IL tuples:

     elem(tag: list
          args: ILs)

The corresponding SL expression is different depending on the type of the projections of the tuple:

  1. all projections are finite domains of constants
  2. at least one projection is not a finite domain of constants
  1. Here is the corresponding SL expression:
              I
         

    I is an Oz integer encoding the tuple.

  2. Here is the corresponding SL expression:
              SLs
         

    SLs is an Oz list of SL expressions encoding ILs.

4.13.12 Undetermined values

The XDK solver can also yield partial solutions in which not all values in the node record are determined; instead some of the values are still undetermined variables. In the following, we show how these variables are represented in the SL.

4.13.12.1 Undetermined cardinality sets

This is the SL syntax for undetermined cardinality sets (i.e. cardinality set variables) in valencies:

     MSpec1#MSpec2#DSpec

MSpec1 is a set specification representing the set of integers which are already known to be in the cardinality set variable.

MSpec2 is a set specification representing the set of integers which could still end up in the cardinality set variable.

DSpec is a domain specification representing the set of integers which can still be bound to the integer variable representing the cardinality of the cardinality set variable.

4.13.12.2 Undetermined constants

This is the SL syntax for undetermined constants (i.e. constant variables):

     DSpec

DSpec is a domain specification, representing the set of constants which can still be bound to the constant variable.

4.13.12.3 Undetermined integers

This is the SL syntax for undetermined integers (i.e. integer variables):

     DSpec

DSpec is a domain specification representing the set of integers which can still be bound to the integer variable.

4.13.12.4 Undetermined lists

This is the SL syntax for undetermined lists (i.e. list variables):

     _
4.13.12.5 Undetermined sets

The SL syntax for undetermined sets (i.e. set variables) differs depending on the domain of the set:

  1. a finite domain of constants or a tuple of which all projections are finite domains of constants
  2. any other type
  1. Below, we show the SL syntax for undetermined sets over finite domains of constants or tuples of which all projections are finite domains of constants:
              MSpec1#MSpec2#DSpec
         

    MSpec1 is a set specification, representing the set of constants which are already known to be in the set variable.

    MSpec2 is a set specification representing the set of constants which could still end up in the set variable.

    DSpec is a domain specification representing the set of integers which can still be bound to the integer variable representing the cardinality of the set variable.

  2. Below, we show the SL syntax for undetermined sets over any other domain:
              _
         
4.13.12.6 Undetermined strings

This is the SL syntax for undetermined strings (i.e. string variables):

     _
4.13.12.7 Undetermined tuples

The SL syntax for undetermined tuples (i.e. tuple variables) differs depending on the projections of the tuple:

  1. all projections are finite domains of constants
  2. at least one of the projections is not a finite domain of constants
  1. Below, we show the SL syntax for undetermined tuples where all projections are finite domains of constants:
              DSpec
         

    DSpec is a domain specification representing the set of tuples which can still be bound to the tuple variable.

    2) Below, we show the SL syntax for undetermined tuples where at least one projection is not a finite domain of constants:

              _