@top Problem { statement* } statement { ProblemDeclaration { ckw<"problem"> QualifiedName "." } | ClassDefinition { ckw<"abstract">? ckw<"class"> RelationName (ckw<"extends"> sep<",", RelationName>)? (ClassBody { "{" ReferenceDeclaration* "}" } | ".") } | EnumDefinition { ckw<"enum"> RelationName (EnumBody { "{" sep<",", UniqueNodeName> "}" } | ".") } | PredicateDefinition { (ckw<"error"> ckw<"pred">? | ckw<"pred">) RelationName ParameterList? PredicateBody { ("<->" sep)? "." } } | Assertion { ckw<"default">? (NotOp | UnknownOp)? RelationName ParameterList (":" LogicValue)? "." } | NodeValueAssertion { UniqueNodeName ":" Constant "." } | UniqueDeclaration { ckw<"unique"> sep<",", UniqueNodeName> "." } | ScopeDeclaration { ckw<"scope"> sep<",", ScopeElement> "." } } ReferenceDeclaration { (kw<"refers"> | kw<"contains">)? RelationName RelationName ( "[" Multiplicity? "]" )? (kw<"opposite"> RelationName)? ";"? } Parameter { RelationName? VariableName } Conjunction { ("," | Literal)+ } OrOp { ";" } Literal { NotOp? Atom } Atom { RelationName ParameterList? } Argument { VariableName | Constant } AssertionArgument { NodeName | StarArgument | Constant } Constant { Real | String } LogicValue { ckw<"true"> | ckw<"false"> | ckw<"unknown"> | ckw<"error"> } ScopeElement { RelationName ("=" | "+=") Multiplicity } Multiplicity { (IntMult "..")? (IntMult | StarMult)} RelationName { QualifiedName } UniqueNodeName { QualifiedName } VariableName { QualifiedName } NodeName { QualifiedName } QualifiedName { identifier ("::" identifier)* } kw { @specialize[@name={term}] } ckw { @extend[@name={term}] } ParameterList { "(" sep<",", content> ")" } sep { sep1? } sep1 { content (separator content?)* } @skip { LineComment | BlockComment | whitespace } @tokens { whitespace { std.whitespace+ } LineComment { ("//" | "%") ![\n]* } BlockComment { "/*" blockCommentRest } blockCommentRest { ![*] blockCommentRest | "*" blockCommentAfterStar } blockCommentAfterStar { "/" | "*" blockCommentAfterStar | ![/*] blockCommentRest } @precedence { BlockComment, LineComment } identifier { $[A-Za-z_] $[a-zA-Z0-9_]* } int { $[0-9]+ } IntMult { int } StarMult { "*" } Real { "-"? (exponential | int ("." (int | exponential))?) } exponential { int ("e" | "E") ("+" | "-")? int } String { "'" (![\\'\n] | "\\" ![\n] | "\\\n")+ "'" | "\"" (![\\"\n] | "\\" (![\n] | "\n"))* "\"" } NotOp { "!" } UnknownOp { "?" } StarArgument { "*" } "{" "}" "(" ")" "[" "]" "." ".." "," ":" "<->" } @detectDelim