aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/language/problem.grammar
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/frontend/src/language/problem.grammar')
-rw-r--r--subprojects/frontend/src/language/problem.grammar31
1 files changed, 15 insertions, 16 deletions
diff --git a/subprojects/frontend/src/language/problem.grammar b/subprojects/frontend/src/language/problem.grammar
index 0f6ea3e1..829dc138 100644
--- a/subprojects/frontend/src/language/problem.grammar
+++ b/subprojects/frontend/src/language/problem.grammar
@@ -11,12 +11,13 @@
11@precedence { 11@precedence {
12 cast, 12 cast,
13 prefix, 13 prefix,
14 range @left,
14 exponential @right, 15 exponential @right,
15 multiplicative @left, 16 multiplicative @left,
16 additive @left, 17 additive @left,
17 range @left,
18 lattice @left, 18 lattice @left,
19 comparison @left, 19 comparison @left,
20 boolean @left,
20 assignment, 21 assignment,
21 feature @cut 22 feature @cut
22} 23}
@@ -45,7 +46,10 @@ statement {
45 (EnumBody { "{" sep<",", AtomNodeName> "}" } | ".") 46 (EnumBody { "{" sep<",", AtomNodeName> "}" } | ".")
46 } | 47 } |
47 DatatypeDeclaration { 48 DatatypeDeclaration {
48 kw<"extern"> kw<"datatype"> DatatypeName "." 49 kw<"extern"> ckw<"datatype"> DatatypeName "."
50 } |
51 AggregatorDeclaration {
52 kw<"extern"> ckw<"aggregator"> AggregatorName "."
49 } | 53 } |
50 PredicateDefinition { 54 PredicateDefinition {
51 ( 55 (
@@ -92,7 +96,7 @@ FeatureDeclaration {
92 ";"? 96 ";"?
93} 97}
94 98
95Parameter { Modality? RelationName? VariableName } 99Parameter { RelationName? VariableName }
96 100
97// Use @dynamicPrecedence to prevent a(b) from being parsed as Expr { a } Expr { b } 101// Use @dynamicPrecedence to prevent a(b) from being parsed as Expr { a } Expr { b }
98// instead of Atom { a(b) } 102// instead of Atom { a(b) }
@@ -111,22 +115,23 @@ Expr {
111AssignmentExpr { !assignment VariableName kw<"is"> Expr } 115AssignmentExpr { !assignment VariableName kw<"is"> Expr }
112 116
113BinaryExpr { 117BinaryExpr {
118 Expr !boolean ("&&" | "||" | "^^") Expr |
114 Expr !comparison ComparisonOp Expr | 119 Expr !comparison ComparisonOp Expr |
115 Expr !lattice (LatticeMeet | "\\/") Expr | 120 Expr !lattice (LatticeMeet | "\\/") Expr |
116 Expr !range ".." Expr |
117 Expr !additive ("+" | "-") Expr | 121 Expr !additive ("+" | "-") Expr |
118 Expr !multiplicative (StarMult | Divide) Expr | 122 Expr !multiplicative (StarMult | Divide) Expr |
119 Expr !exponential "**" Expr 123 Expr !exponential "**" Expr |
124 Expr !range ".." Expr
120} 125}
121 126
122UnaryExpr { 127UnaryExpr {
123 !prefix ("+" | "-" | "!" | kw<"count"> | Modality) Expr 128 !prefix ("+" | "-" | "!" | kw<"count">) Expr
124} 129}
125 130
126CastExpr { !cast Expr kw<"as"> DatatypeName } 131CastExpr { !cast Expr kw<"as"> DatatypeName }
127 132
128Aggregation { 133Aggregation {
129 AggregationOp "{" Expr "|" Expr "}" 134 AggregatorName "{" Expr "|" Expr "}"
130} 135}
131 136
132Atom { RelationName "+"? ParameterList<Expr> } 137Atom { RelationName "+"? ParameterList<Expr> }
@@ -151,14 +156,6 @@ LogicValue {
151 kw<"true"> | kw<"false"> | kw<"unknown"> | kw<"error"> 156 kw<"true"> | kw<"false"> | kw<"unknown"> | kw<"error">
152} 157}
153 158
154Modality {
155 kw<"must"> | kw<"may"> | kw<"current">
156}
157
158AggregationOp {
159 ckw<"sum"> | ckw<"prod"> | ckw<"min"> | ckw<"max">
160}
161
162ComparisonOp { SymbolicComparisonOp | kw<"in"> } 159ComparisonOp { SymbolicComparisonOp | kw<"in"> }
163 160
164ScopeElement { RelationName ("=" | "+=") Multiplicity } 161ScopeElement { RelationName ("=" | "+=") Multiplicity }
@@ -183,6 +180,8 @@ NodeName { QualifiedName }
183 180
184ModuleName { QualifiedName } 181ModuleName { QualifiedName }
185 182
183AggregatorName { QualifiedName }
184
186QualifiedName[implicitCompletion=true] { "::"? identifier (QualifiedNameSeparator "::" identifier)* } 185QualifiedName[implicitCompletion=true] { "::"? identifier (QualifiedNameSeparator "::" identifier)* }
187 186
188kw<term> { @specialize[@name={term},implicitCompletion=true]<identifier, term> } 187kw<term> { @specialize[@name={term},implicitCompletion=true]<identifier, term> }
@@ -237,7 +236,7 @@ sep1<separator, content> { content (separator content)* }
237 236
238 SymbolicComparisonOp { 237 SymbolicComparisonOp {
239 ">" | ">=" | "<" | "<=" | "==" | "!=" | 238 ">" | ">=" | "<" | "<=" | "==" | "!=" |
240 "<:" | ":>" | "===" | "!==" 239 "===" | "!=="
241 } 240 }
242 241
243 NotOp { "!" } 242 NotOp { "!" }