Specification of Configuration Description Language

The CDL is a language to define complex types out of some 
predefined basic type templates and also to assign values to 
instances of such types. Type specifications can be much 
more specifically made than what is usually known from programming 
languages. For instance a string type defines not only 
a sequence of characters, but also which characters are 
allowed in which patterns and length. This is realized using
template like semantics.

CDL consists of multiple subsections each having a 
a slightly different syntax and semantics. These sections are:

CDLT - Type definions
CDLS - Configuration settings (same syntax as CDLT)
CDLV - Value assignments for config variables defined in CDLS

The following will describe syntax and semantics of CDL:

Fundamental Types (they can't be used in CDLT itself, but are used
                   to define the types of the template params):

   string:  sequence of characters
   int:     32 bit integer
   boolean: true or false

Basic Type Templates:

   string<string regexp, int minlen, int maxlen>:
      regexp: regular expressioen validating the string
      minlen, maxlen: bounds of the string

   int<int min, int max>
      min, max: min and max value of the int

   vector<elementtype, indextype, int maxlen>:
      elementtype: type name of the elements
      indextype: type name of indextype (only string() and int() allowed)
      maxlen:    bounds of the vector

Grammar:

a) Keywords:

   boolean int string enum struct choice vector fktdecl type
   true false
   types configs values

b) Lexical conventions:

   token:
      keyword
      identifier
      literal
      punctuator

   identifier:
      nondigit
      identifier nondigit
      identifier digit

   literal:
      string-literal
      int-literal
      boolean-literal

   string-literal:
      "char-sequence"

   int-literal:
      digit
      int-literal digit

   boolean-literal:
      true
      false

   digit:
      [0-9]

   nondigit:
      [A-Za-z_-]

   char-sequence:
      char
      char-sequence char

   char:
      <any member of source char set except double-qoute>
      escape-sequence

   escape-sequence:
      \"

c) Config Description:

   configuration-description:
      configuration-section
      configuration-description configuration-section

   configuration-section:
      types-section
      configs-section
      values-section   

d) Declarations:

   types-section:
      types { type-decl-seq };

   configs-section:
      configs { type-decl-seq };

   values-section:
      values { assignment-expr-seq };

   type-decl-seq:
      type-decl
      type-decl-seq type-decl

   type-decl:
      basic-type-decl ;
      basic-type-decl { property-list };

   basic-type-decl:
      simple-type-decl
      alias-type-decl
      vector-template-type-decl
      vector-template-instantiation

   simple-type-decl:
      identifier : simple-type

   alias-type-decl:
      identifier : qualified-identifier

   vector-template-type-decl:
      identifier < type identifier > : vector-template-type

   vector-template-instantiation:
      identifier : qualified-identifier < qualified-identifier >

   simple-type:
      boolean-type
      fkt-decl-type
      string-template-type
      int-template-type
      enumeration-type
      choice-template-type
      structured-type 
      vector-template-type

   boolean-type:
      boolean;

   fkt-decl-type:
      fktdecl;      

   string-template-type:
      string < string-literal , int-literal , int-literal >

   int-template-type:
      int < int-literal , int-literal >

   enumaration-type:
      enum { enumerator-list }

   choice-template-type:
      choice < qualified-identifier > { type-decl-seq }

   structured-type:
      struct { type-decl-seq }

   vector-template-type:
      vector < qualified-identifier , fundamental-type , int-literal >

   enumerator-list:
      enumerator
      enumerator-list , enumerator

   enumerator:
      identifier
      identifier { property-list }

   property-list:
      property
      property-list property

   property:
      text-property
      flag-property

   text-property:
      identifier : string-literal ;
      
   flag-property:
      identifier : flag-list ;

   flag-list:
      identifier
      flag-list , identifier

   qualified-identifier:
      qualified-identifier . identifier

   fundamental-type
      boolean
      int
      string
  
e) Expressions:
   
   assignment-expr-seq:
      assignment-expr
      assignment-expr-seq assignment-expr

   assignment-expr:
      qualified-config-key = value-expr ;

   qualified-config-key:
      config-key
      qualified-config-key . config-key

   config-key-identifier:
      identifier
      identifier [ literal ] 

   value-expr:
      literal
      enum-value
      choice-value
      fkt-decl
      { value-expr-list }

   enum-value:
      identifier

   choice-value:
      identifier { value-expr-list }

   fkt-decl:
      identifier ( fkt-param-list ) { property-list }

   fkt-param-list:
      fkt-param
      fkt-param-list , fkt-param

   fkt-param:
      identifier : fkt-param-type

   fkt-param-type:
      qualified-identifier
      string-template-type
      int-template-type

   value-expr-list:
      value-expr
      value-expr-list , value-expr
      assignment-expr-seq

