diff options
Diffstat (limited to 'subprojects/frontend/src/language/problem.grammar')
-rw-r--r-- | subprojects/frontend/src/language/problem.grammar | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/subprojects/frontend/src/language/problem.grammar b/subprojects/frontend/src/language/problem.grammar index 7949f90c..0d3f0e3a 100644 --- a/subprojects/frontend/src/language/problem.grammar +++ b/subprojects/frontend/src/language/problem.grammar | |||
@@ -63,11 +63,11 @@ statement { | |||
63 | // kw<"fn"> RelationName RelationName ParameterList<Parameter>? | 63 | // kw<"fn"> RelationName RelationName ParameterList<Parameter>? |
64 | // FunctionBody { ("=" sep<OrOp, Case>)? "." } | 64 | // FunctionBody { ("=" sep<OrOp, Case>)? "." } |
65 | // } | | 65 | // } | |
66 | //RuleDefinition { | 66 | RuleDefinition { |
67 | // kw<"rule"> | 67 | (ckw<"decision"> | ckw<"propagation">)? kw<"rule"> |
68 | // RuleName ParameterList<Parameter>? | 68 | RuleName ParameterList<Parameter>? |
69 | // RuleBody { ":" sep<OrOp, Conjunction> "==>" sep<OrOp, Consequent> "." } | 69 | RuleBody { ":" sep<OrOp, Conjunction> "==>" sep<OrOp, Consequent> "." } |
70 | //} | | 70 | } | |
71 | AtomDeclaration { | 71 | AtomDeclaration { |
72 | kw<"declare">? ckw<"atom"> sep<",", AtomNodeName> "." | 72 | kw<"declare">? ckw<"atom"> sep<",", AtomNodeName> "." |
73 | } | | 73 | } | |
@@ -96,7 +96,12 @@ FeatureDeclaration { | |||
96 | ";"? | 96 | ";"? |
97 | } | 97 | } |
98 | 98 | ||
99 | Parameter { RelationName? VariableName } | 99 | Parameter { |
100 | kw<"candidate">? (kw<"may"> | kw<"must">)? | ||
101 | RelationName? | ||
102 | (AndBinding | StarBinding)? | ||
103 | VariableName | ||
104 | } | ||
100 | 105 | ||
101 | // Use @dynamicPrecedence to prevent a(b) from being parsed as Expr { a } Expr { b } | 106 | // Use @dynamicPrecedence to prevent a(b) from being parsed as Expr { a } Expr { b } |
102 | // instead of Atom { a(b) } | 107 | // instead of Atom { a(b) } |
@@ -125,7 +130,12 @@ BinaryExpr { | |||
125 | } | 130 | } |
126 | 131 | ||
127 | UnaryExpr { | 132 | UnaryExpr { |
128 | !prefix ("+" | "-" | "!" | kw<"count">) Expr | 133 | !prefix |
134 | ( | ||
135 | "+" | "-" | "!" | kw<"count"> | | ||
136 | kw<"candidate"> | kw<"may"> | kw<"must"> | ||
137 | ) | ||
138 | Expr | ||
129 | } | 139 | } |
130 | 140 | ||
131 | CastExpr { !cast Expr kw<"as"> DatatypeName } | 141 | CastExpr { !cast Expr kw<"as"> DatatypeName } |
@@ -136,16 +146,18 @@ Aggregation { | |||
136 | 146 | ||
137 | Atom { RelationName "+"? ParameterList<Expr> } | 147 | Atom { RelationName "+"? ParameterList<Expr> } |
138 | 148 | ||
139 | //Consequent { ("," | Action)+ } | 149 | Consequent { ("," | Action)+ } |
140 | 150 | ||
141 | //Action { | 151 | Action { |
142 | // ckw<"new"> VariableName ("<:" VariableName)? | | 152 | (NotOp | UnknownOp)? RelationName |
143 | // kw<"delete"> VariableName | | 153 | ParameterList<AssertionActionArgument> |
144 | // Literal | 154 | (":" Expr)? |
145 | //} | 155 | } |
146 | 156 | ||
147 | AssertionArgument { NodeName | StarArgument } | 157 | AssertionArgument { NodeName | StarArgument } |
148 | 158 | ||
159 | AssertionActionArgument { VariableName | StarArgument } | ||
160 | |||
149 | Constant { Real | String | StarMult | LogicValue } | 161 | Constant { Real | String | StarMult | LogicValue } |
150 | 162 | ||
151 | ReferenceKind { | 163 | ReferenceKind { |
@@ -170,7 +182,7 @@ RelationName { QualifiedName ~name } | |||
170 | 182 | ||
171 | DatatypeName { QualifiedName } | 183 | DatatypeName { QualifiedName } |
172 | 184 | ||
173 | //RuleName { QualifiedName } | 185 | RuleName { QualifiedName } |
174 | 186 | ||
175 | AtomNodeName { QualifiedName } | 187 | AtomNodeName { QualifiedName } |
176 | 188 | ||
@@ -247,5 +259,9 @@ sep1<separator, content> { content (separator content)* } | |||
247 | 259 | ||
248 | StarArgument { "*" } | 260 | StarArgument { "*" } |
249 | 261 | ||
262 | StarBinding { "*" } | ||
263 | |||
264 | AndBinding { "&" } | ||
265 | |||
250 | "{" "}" "(" ")" "[" "]" "." ".." "," ":" "->" "<->" "+" "-" "**" "=" "+=" | 266 | "{" "}" "(" ")" "[" "]" "." ".." "," ":" "->" "<->" "+" "-" "**" "=" "+=" |
251 | } | 267 | } |