cd: Example = List(GenVoca) *EOF*. GenVoca = "realms" Realms "compositions" Compositions "restrictions" Restrictions. Realm = RealmName "=" Components. Component = ComponentName [Parameters]. Parameter = RealmName. Restriction = ComponentName Constraints Constraints Constraints Constraints. Constraint = "c". // not implemented Composition = ComponentName "=" Exp. Exp = ComponentName [Exps]. // repetition buffer rule Realms = List(Realm). Compositions = List(Composition). Restrictions = List(Restriction). Components = List(Component). Parameters = List(Parameter). Exps = List(Exp). Constraints = List(Constraint). // terminal buffer rule ComponentName = Ident. RealmName = Ident. List(S) ~ "(" S { "," S} ")". Main = . Behavior file: Main { (@ static public void main(String args[]) throws Exception { Example e = Example.parse(System.in); } @) } input object // first GenVoca example: part of P2 // container class implementations ( realms ( ds = ( bintree (ds), // binary tree dlist (ds), // unordered doubly linked list odlist (ds) // key-ordered list ), mem = (transient, persistent)) compositions ( ex1 = conceptual(bintree(heap(transient)))) restrictions ( bintree (c) (c) (c) (c) ) , // second GenVoca example: P2 (modified for Demeter/Java) realms ( ds = ( list (mem), // linked list vector (mem), // Java vector array (mem), // Java array hashtable(mem), // Java hashtable preorder (ds), // preorder traversal postorder (ds), // postorder traversal printable (ds), // create print function comparable (ds),// generate comparison function copyable (ds), // generate copy function displayable(ds),// generate display function parsable(ds), // generate parse function ordered (ds) // elements are ordered (key not shown) ), mem = (transient, persistent)) compositions ( ex1 = parsable(printable(preorder(vector(transient)))) // the collection is implemented as a vector with a preorder traversal // methods as well as code for printing (visitor) and parsing , default = parsable(displayable(copyable(comparable( printable(preorder(list(transient))))))) // the default setting used by Demeter/Java for collection classes ) restrictions ( vector (c) (c) (c) (c) ) )