Boost logo

Boost :

From: Vesa Karvonen (vesa.karvonen_at_[hidden])
Date: 2001-05-30 16:07:33


Hi,

I like the idea of expressing feature models using a language that is more
suitable for textual representation. Unfortunately I find it difficult to
express some feature models using the grammar described on the Boost site
http://www.boost.org/more/feature_model_diagrams.htm).

What is the recommended way to represent a node with both mandatory and
optional features? For example:

    concept
        |
        +---* mandatory_feature_a
        |
        +---* mandatory_feature_b
        |
        +---o optional_feature_a
        |
        +---o optional_feature_b

Assuming that I understand the grammar correctly, the closest that I can
come to is:

    concept
        ( mandatory_feature_a
        , mandatory_feature_b
        , optional_features
        )

    optional_features
        [ optional_feature_a
        + optional_feature_b
        ]

As you can see, I had to introduce a dummy "optional_features" node. The
above two feature models are no longer technically the same.

Have I misunderstood the grammar or is this a weakness of the grammar?

In case the problem is with the grammar, then I would like to have a more
powerful grammar. The following grammar is a rather one-to-one mapping of
the feature model notation represented in Czarnecki & Eisenecker.

<---- BEGIN FEATURE MODEL GRAMMAR ---->
feature-model ::= concept-name details { feature }

feature ::= feature-name [ details ]

details ::= "(" feature-group { "," feature-group } ")"

feature-group ::= "{" feature-link { "|" feature-link } "}" // alternative
                | "{" feature-link { "+" feature-link } "}" // or
                | feature-link { "," feature-link } // no arc

feature-link ::= "[" feature "]" // optional feature
              | feature // mandatory feature

concept-name ::= name

feature-name ::= name
<---- END FEATURE MODEL GRAMMAR ---->

This grammar makes it possible to represent the original diagram
accurately:

    concept
        ( mandatory_feature_a
        , mandatory_feature_b
        , [optional_feature_a]
        , [optional_feature_b]
        )

Here is the example from the Boost site:

    special-container ( organization,
                        performance,
                        interface ) // all required
    organization ( { [ordered] + [indexed] } ) // zero or more (4
configurations)
    indexed ( [hash-function] ) // zero or one (2
configurations)
    performance ( {fast | small | balanced} ) // exactly one (3
configurations)
    interface ( {STL-style + cursor-style} ) // one or more (3
configurations)

As you can see, there are more ()'s, []'s, and {}'s.

Right now I'm in a big hurry, so if there is a bug in the grammar or the
examples, then I must apologize for it.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk