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.grammar26
1 files changed, 19 insertions, 7 deletions
diff --git a/subprojects/frontend/src/language/problem.grammar b/subprojects/frontend/src/language/problem.grammar
index ce3baa02..b69ee73f 100644
--- a/subprojects/frontend/src/language/problem.grammar
+++ b/subprojects/frontend/src/language/problem.grammar
@@ -1,5 +1,5 @@
1/* 1/*
2 * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> 2 * SPDX-FileCopyrightText: 2021-2024 The Refinery Authors <https://refinery.tools/>
3 * 3 *
4 * SPDX-License-Identifier: EPL-2.0 4 * SPDX-License-Identifier: EPL-2.0
5 */ 5 */
@@ -22,13 +22,16 @@
22@top Problem { statement* } 22@top Problem { statement* }
23 23
24statement { 24statement {
25 ImportStatement {
26 kw<"import"> ModuleName (kw<"as"> ModuleName)? "."
27 } |
25 Assertion { 28 Assertion {
26 kw<"default">? (NotOp | UnknownOp)? RelationName 29 kw<"default">? (NotOp | UnknownOp)? RelationName
27 ParameterList<AssertionArgument> 30 ParameterList<AssertionArgument>
28 (":" Expr)? "." 31 (":" Expr)? "."
29 } | 32 } |
30 ProblemDeclaration { 33 ProblemDeclaration {
31 kw<"problem"> QualifiedName "." 34 (ckw<"module"> | kw<"problem">) ModuleName "."
32 } | 35 } |
33 ClassDefinition { 36 ClassDefinition {
34 kw<"abstract">? kw<"class"> RelationName 37 kw<"abstract">? kw<"class"> RelationName
@@ -37,7 +40,7 @@ statement {
37 } | 40 } |
38 EnumDefinition { 41 EnumDefinition {
39 kw<"enum"> RelationName 42 kw<"enum"> RelationName
40 (EnumBody { "{" sep<",", IndividualNodeName> "}" } | ".") 43 (EnumBody { "{" sep<",", AtomNodeName> "}" } | ".")
41 } | 44 } |
42 PredicateDefinition { 45 PredicateDefinition {
43 ( 46 (
@@ -56,8 +59,11 @@ statement {
56 // RuleName ParameterList<Parameter>? 59 // RuleName ParameterList<Parameter>?
57 // RuleBody { ":" sep<OrOp, Conjunction> "==>" sep<OrOp, Consequent> "." } 60 // RuleBody { ":" sep<OrOp, Conjunction> "==>" sep<OrOp, Consequent> "." }
58 //} | 61 //} |
59 IndividualDeclaration { 62 AtomDeclaration {
60 kw<"indiv"> sep<",", IndividualNodeName> "." 63 kw<"declare">? ckw<"atom"> sep<",", AtomNodeName> "."
64 } |
65 NodeDeclaration {
66 (kw<"declare"> | kw<"declare">? ckw<"multi">) sep<",", NodeName> "."
61 } | 67 } |
62 ScopeDeclaration { 68 ScopeDeclaration {
63 kw<"scope"> sep<",", ScopeElement> "." 69 kw<"scope"> sep<",", ScopeElement> "."
@@ -161,13 +167,15 @@ RelationName { QualifiedName ~name }
161 167
162//RuleName { QualifiedName } 168//RuleName { QualifiedName }
163 169
164IndividualNodeName { QualifiedName } 170AtomNodeName { QualifiedName }
165 171
166VariableName[@dynamicPrecedence=10] { QualifiedName ~name } 172VariableName[@dynamicPrecedence=10] { QualifiedName ~name }
167 173
168NodeName { QualifiedName } 174NodeName { QualifiedName }
169 175
170QualifiedName[implicitCompletion=true] { identifier ("::" identifier)* } 176ModuleName { QualifiedName }
177
178QualifiedName[implicitCompletion=true] { "::"? identifier (QualifiedNameSeparator "::" identifier)* }
171 179
172kw<term> { @specialize[@name={term},implicitCompletion=true]<identifier, term> } 180kw<term> { @specialize[@name={term},implicitCompletion=true]<identifier, term> }
173 181
@@ -181,6 +189,10 @@ sep1<separator, content> { content (separator content)* }
181 189
182@skip { LineComment | BlockComment | whitespace } 190@skip { LineComment | BlockComment | whitespace }
183 191
192@external tokens qualifiedNameSeparator from "./tokens" {
193 QualifiedNameSeparator
194}
195
184@tokens { 196@tokens {
185 whitespace { std.whitespace+ } 197 whitespace { std.whitespace+ }
186 198