@top Problem { statement* } statement { ProblemDeclaration { ckw<"problem"> QualifiedName "." } | ClassDefinition { ckw<"abstract">? ckw<"class"> 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)? "." } | UniqueDeclaration { ckw<"unique"> sep<",", UniqueNodeName> "." } | ScopeDeclaration { ckw<"scope"> sep<",", ScopeElement> "." } } ReferenceDeclaration { ((kw<"refers"> | kw<"contains">) !times RelationName | !plus RelationName) RelationName ( "[" Multiplicity? "]" )? (kw<"opposite"> RelationName)? ";"? } @precedence { times @left, plus } Parameter { RelationName? VariableName } Conjunction { sep1<",", Literal> } OrOp { ";" } Literal { NotOp? Atom } Atom { RelationName ParameterList? } Argument { VariableName | Real } AssertionArgument { NodeName | StarArgument | Real } 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 } NotOp { "!" } UnknownOp { "?" } StarArgument { "*" } "{" "}" "(" ")" "[" "]" "." ".." "," ":" "<->" } @detectDelim