diff options
author | Kristóf Marussy <kristof@marussy.com> | 2022-11-20 20:52:17 +0100 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2022-11-22 16:40:03 +0100 |
commit | 19d38b03de9af68e6234a2a07ac54c36d73edaa7 (patch) | |
tree | f6c402aa3610bdf66fb842e3b6206622eed8a2fd /subprojects/frontend/src/language/problem.grammar | |
parent | refactor(test): WebSocket integ test robustness (diff) | |
download | refinery-19d38b03de9af68e6234a2a07ac54c36d73edaa7.tar.gz refinery-19d38b03de9af68e6234a2a07ac54c36d73edaa7.tar.zst refinery-19d38b03de9af68e6234a2a07ac54c36d73edaa7.zip |
refactor(language): simplify syntax
Diffstat (limited to 'subprojects/frontend/src/language/problem.grammar')
-rw-r--r-- | subprojects/frontend/src/language/problem.grammar | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/subprojects/frontend/src/language/problem.grammar b/subprojects/frontend/src/language/problem.grammar index 7c4098d5..c2410913 100644 --- a/subprojects/frontend/src/language/problem.grammar +++ b/subprojects/frontend/src/language/problem.grammar | |||
@@ -3,6 +3,7 @@ | |||
3 | @external prop implicitCompletion from './props' | 3 | @external prop implicitCompletion from './props' |
4 | 4 | ||
5 | @precedence { | 5 | @precedence { |
6 | reference @cut, | ||
6 | prefix, | 7 | prefix, |
7 | exponential @right, | 8 | exponential @right, |
8 | multiplicative @left, | 9 | multiplicative @left, |
@@ -47,10 +48,10 @@ statement { | |||
47 | Assertion { | 48 | Assertion { |
48 | kw<"default">? (NotOp | UnknownOp)? RelationName | 49 | kw<"default">? (NotOp | UnknownOp)? RelationName |
49 | ParameterList<AssertionArgument> | 50 | ParameterList<AssertionArgument> |
50 | (":" LogicValue | ("=" | kw<"in">) Expr)? "." | 51 | (":" Expr)? "." |
51 | } | | 52 | } | |
52 | IndividualDeclaration { | 53 | IndividualDeclaration { |
53 | kw<"individual"> sep<",", IndividualNodeName> "." | 54 | kw<"indiv"> sep<",", IndividualNodeName> "." |
54 | } | | 55 | } | |
55 | ScopeDeclaration { | 56 | ScopeDeclaration { |
56 | kw<"scope"> sep<",", ScopeElement> "." | 57 | kw<"scope"> sep<",", ScopeElement> "." |
@@ -58,7 +59,8 @@ statement { | |||
58 | } | 59 | } |
59 | 60 | ||
60 | FeatureDeclaration { | 61 | FeatureDeclaration { |
61 | (ReferenceKind | PrimitiveType | kw<"bool">) RelationName | 62 | // The @cut helps disambiguate silly cases like `contains contains` |
63 | (ReferenceKind !reference | PrimitiveType | kw<"bool">)? RelationName | ||
62 | ("[" Multiplicity? "]")? | 64 | ("[" Multiplicity? "]")? |
63 | RelationName | 65 | RelationName |
64 | (kw<"opposite"> RelationName)? | 66 | (kw<"opposite"> RelationName)? |
@@ -90,7 +92,7 @@ BinaryExpr { | |||
90 | } | 92 | } |
91 | 93 | ||
92 | UnaryExpr { | 94 | UnaryExpr { |
93 | !prefix ("+" | "-" | "!" | "#" | Modality) Expr | 95 | !prefix ("+" | "-" | "!" | kw<"count"> | Modality) Expr |
94 | } | 96 | } |
95 | 97 | ||
96 | Aggregation { | 98 | Aggregation { |
@@ -109,7 +111,7 @@ Atom { RelationName "+"? ParameterList<Expr> } | |||
109 | 111 | ||
110 | AssertionArgument { NodeName | StarArgument } | 112 | AssertionArgument { NodeName | StarArgument } |
111 | 113 | ||
112 | Constant { Real | String | StarMult } | 114 | Constant { Real | String | StarMult | LogicValue } |
113 | 115 | ||
114 | ReferenceKind { | 116 | ReferenceKind { |
115 | kw<"refers"> | ckw<"contains"> | kw<"container"> | 117 | kw<"refers"> | ckw<"contains"> | kw<"container"> |
@@ -199,7 +201,10 @@ sep1<separator, content> { content (separator content)* } | |||
199 | "\"" (![\\"\n] | "\\" (![\n] | "\n"))* "\"" | 201 | "\"" (![\\"\n] | "\\" (![\n] | "\n"))* "\"" |
200 | } | 202 | } |
201 | 203 | ||
202 | SymbolicComparisonOp { ">" | ">=" | "<" | "<=" | "==" | "!=" } | 204 | SymbolicComparisonOp { |
205 | ">" | ">=" | "<" | "<=" | "==" | "!=" | | ||
206 | "<:" | ":>" | "===" | "!==" | ||
207 | } | ||
203 | 208 | ||
204 | NotOp { "!" } | 209 | NotOp { "!" } |
205 | 210 | ||