// by Ahmed Mohsen and Karl Lieberherr // Nov. 9, 2006 // a relation referenced in a constraint must be referenced by name // If you support negated literals in the scope of // a constraint, you get extra credit. // Note that the outsourcing team expects fractions for relations // where all variables are not negated. // semantic checks // nbValues consistent with tuples // nbConstraints correct // nbVariables correct // all relations must be defined by relation number Instance = "<" "instance" ">" PresentationXMLElement [ DomainsXMLElement] VariablesXMLElement RelationsXMLElement ConstraintsXMLElement "<" "/" "instance" ">" EOF. //presentation XML element PresentationXMLAttribute: PresentationNameAttribute | PresentationMaxConstraintArityAttribute | PresentationNbSolutionAttribute | PresentationSolutionAttribute | PresentationMaxSatisfiableConstraintsAttribute | PresentationFormatAttribute. PresentationNameAttribute = "name" "=" String. PresentationMaxConstraintArityAttribute = "maxConstraintArity" "=" String. PresentationNbSolutionAttribute = "nbSolutions" "=" String. PresentationSolutionAttribute = "solution" "=" String. PresentationMaxSatisfiableConstraintsAttribute = "maxSatisfiableConstraints" "=" String. PresentationFormatAttribute = "format" "=" String. PresentationXMLAttributeList = List(PresentationXMLAttribute). PresentationXMLElement = "<" "presentation" PresentationXMLAttributeList "/" ">". //domain XML element DomainNameAttribute = "name" "=" String. DomainNbValuesAttribute = "nbValues" "=" String. DomainExp: Num|Dot. Num = int. Dot = "..". DomainXMLElement = "domain" [DomainNameAttribute] DomainNbValuesAttribute ">" List(DomainExp) "<" "/" "domain" ">" "<". //domains XML element DomainsNbDomainsAttribute = "nbDomains" "=" String. DomainsXMLElement = /// !! change "" "<" List(DomainXMLElement) "/" "domains" ">". //variable XML element variableNameAttribute = "name" "=" String. variableDomainAttribute = "domain" "=" String. VariableXMLElement = "variable" variableNameAttribute variableDomainAttribute "/" ">" "<". VariablesNbVariablesAttribute = "nbVariables" "=" String. VariablesXMLElement = "<" "variables" VariablesNbVariablesAttribute">" "<" List(VariableXMLElement) "/" "variables" ">". //relation XML element RelationNameAttribute = "name" "=" String. RelationNumberAttribute = "number" "=" String. RelationArityAttribute = "arity" "=" String. RelationNbTuplesAttribute = "nbTuples" "=" String. RelationSemanticsAttribute = "semantics" "=" String. RelationXMLElement = "relation" RelationNameAttribute RelationNumberAttribute [RelationArityAttribute] [RelationNbTuplesAttribute] [RelationSemanticsAttribute] ">" [ PipeList(Tuple)] "<" "/" "relation" ">" "<". Tuple = NList(Digit). Digit = int. //Relations XML element RelationsNbRelationsAttribute = "nbRelations" "=" String. RelationsXMLElement = "<" "relations" RelationsNbRelationsAttribute ">" "<" List(RelationXMLElement) "/" "relations" ">". //Constraint XML element ConstraintNameAttribute = "name" "=" String. ConstraintArityAttribute = "arity" "=" String. ConstraintXMLAttributes = [ConstraintNameAttribute] [ConstraintArityAttribute] ScopeAttribute ReferencesAttribute. ScopeAttribute = "scope" "=" String. ReferencesAttribute = "reference" "=" String. ConstraintXMLElement = "constraint" ConstraintXMLAttributes "/" ">" "<". //constraints XML element ConstraintsXMLAttributes = "nbConstraints" "=" String. ConstraintsXMLElement = "<" "constraints" ConstraintsXMLAttributes ">" "<" List(ConstraintXMLElement) "/" "constraints" ">". //Other stuff List(S) ~ {S}. NList(S) ~ S{S}. PipeList(S) ~ S {"|" S}. Main = .