package gen; import edu.neu.ccs.demeterf.demfgen.lib.*; import edu.neu.ccs.demeterf.*; nogen Option(X): Some(X) | None(X). nogen Some(X) = X. nogen None(X) = . nogen List(X) : Cons(X) | Empty(X). nogen Cons(X) = X List(X). nogen Empty(X) = . // for Map extern interface Comparable(X):. nogen Entry(K:Comparable(K),V) = "(" K *s "->" *s V ")". // This doesn't match the real structure of a Map... but it's fine // for Parsing them, as long as the Key is Comparable (Java) // or IComparable (C#) nogen Map(K:Comparable(K),V) = "[" *s RBTree(Entry(K,V)) *s "]". nogen RBColor: RED | BLACK. nogen RED = . nogen BLACK = . nogen RBTree(X:Comparable(X)) : RBNode(X) | RBLeaf(X). nogen RBNode(X:Comparable(X)) = *s RBColor *s X *s RBTree(X) *s RBTree(X) . nogen RBLeaf(X:Comparable(X)) = . // illustrate MapReduce //Start = List(Document) EOF. //Document = "(" // // document names don't appear in the output // DocumentName ":" // List(Word) ")". //Word = ident. //DocumentName = ident. RawMaterial = List(Constraint) EOF. Constraint = Weight RelationNr List(Variable) *l. Weight = int ":" *s. RelationNr = int *s. Variable = ident *s. // Main = .