import edu.neu.ccs.demeter.dj.*; import java.lang.reflect.*; import java.util.*; import java.io.*; import java.lang.Float; import java.lang.Double; XMLSchema = "<" NameSpace ":schema" " xmlns:" NameSpace "=" URL ">" Root List(ComponentDef) " NameSpace ":schema>". NameSpace = Ident. URL = String. List(S) ~ S {S}. //List(S) ~ {S}. Root = "<" NameSpace ":element " NewDec "/>". ComponentDef = "<" NameSpace ComponentDec. ComponentDec : GlobalElement | TypeDef. GlobalElement = ":element " NewDec "/>". // simplified NewDec = NameDec TypeDec [ElementConstraints] . NameDec = "name=" ElementName. ElementConstraints = List(EConstraint). EConstraint: MinOccurs | MaxOccurs. MinOccurs = "minOccurs=" String. MaxOccurs = "maxOccurs=" String. ElementName = String. TypeDec = "type=" TypeName. TypeName = String. TypeDef : SimpleType | ComplexType. SimpleType = ":simpleType " NameDec ">" Restrictions " NameSpace ":simpleType>". Restrictions ="<" NameSpace ":restriction base=" Base ">" List(Restriction) " NameSpace ":restriction>". Base = String. Restriction = "<" NameSpace ":" RangeDef "/>". RangeDef: MinExclusive | MaxExclusive | MinInclusive | MaxInclusive. MinExclusive = "minExclusive" Value. MaxExclusive = "maxExclusive" Value. MinInclusive = "minInclusive" Value. MaxInclusive = "maxInclusive" Value. Value = "value=" Integer. //PrimitiveType.// all kinds of types ComplexType = ":complexType " NameDef [TypeDec] ">" Sequence [ Attributes] " NameSpace ":complexType>". NameDef = "name=" TypeName. Sequence = "<" NameSpace ":sequence>" List(Element) " NameSpace ":sequence>". Element = "<" NameSpace ":element " ElementDef "/>". ElementDef : NewDec | RefDec. //see above for NewDec RefDec = "ref=" ElementName. Attributes = List(Attribute). Attribute = "<" NameSpace ":attribute " AttrNameDec TypeDec [ARestrictions] "/>". ARestrictions = List(Restriction). //see above for Restriction AttrNameDec = "name=" String. //PrimitiveType :Type1 | Type2 | Type3 | Type4.// | Type. //Type1 = String. //Type2 = Ident. //Type3 = Text. //Type4 = Integer.// | Float| Double. CDPrintVisitor = extends Visitor. OurPrintVisitor = CDPrintVisitor extends Visitor. Main = .