3.4 Combining data types

Taking a closer look at the specification syntax shows that there are more possibilities to combine the data types. We can define the CD data type with only one production.

CD::= String:artist 
      Track*:tracks

classgen automatically generates a class TrackList. Additionally we can declare attributes directly in a variant production.

Box::= {HBox}
       | {VBox}
       | {EmptyBox}
       attr boolean valid;

Variants have another feature. If you omit the braces around a sub class classgen automatically generates a record type sub class.

Box::= TBox:sel1
       UBox:sel2
       | {VBox}
       | {EmptyBox}

© copyright 2000, 2001, 2002 Sebastian Winter (winterse@in.tum.de) and Florian Deissenboeck (flo@deissenboeck.de)

© copyright 2000, 2001, 2002 Technical University of Munich, Germany