diff options
author | 2024-01-31 02:00:09 +0100 | |
---|---|---|
committer | 2024-01-31 18:45:13 +0100 | |
commit | c63126d2f1ce5f571c316b37e00fb43d2da7c7d3 (patch) | |
tree | 16e9dd04624565f7c9ccedd17749a9f264e89cb0 /subprojects/frontend/src/language/problem.grammar | |
parent | fix(build): avoid cyclic dependency (diff) | |
download | refinery-c63126d2f1ce5f571c316b37e00fb43d2da7c7d3.tar.gz refinery-c63126d2f1ce5f571c316b37e00fb43d2da7c7d3.tar.zst refinery-c63126d2f1ce5f571c316b37e00fb43d2da7c7d3.zip |
refactor(language): module and node declarations
* New default file extension: .refinery (.problem is also supported).
* Add module keyword for self-contained modules.
* Rename indiv declarations to atom declaration.
* Add node and multi declarations for explicitly declared nodes and
multi-objects, respectively.
Diffstat (limited to 'subprojects/frontend/src/language/problem.grammar')
-rw-r--r-- | subprojects/frontend/src/language/problem.grammar | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/subprojects/frontend/src/language/problem.grammar b/subprojects/frontend/src/language/problem.grammar index ce3baa02..b08a9c36 100644 --- a/subprojects/frontend/src/language/problem.grammar +++ b/subprojects/frontend/src/language/problem.grammar | |||
@@ -28,7 +28,7 @@ statement { | |||
28 | (":" Expr)? "." | 28 | (":" Expr)? "." |
29 | } | | 29 | } | |
30 | ProblemDeclaration { | 30 | ProblemDeclaration { |
31 | kw<"problem"> QualifiedName "." | 31 | (ckw<"module"> | kw<"problem">) QualifiedName "." |
32 | } | | 32 | } | |
33 | ClassDefinition { | 33 | ClassDefinition { |
34 | kw<"abstract">? kw<"class"> RelationName | 34 | kw<"abstract">? kw<"class"> RelationName |
@@ -37,7 +37,7 @@ statement { | |||
37 | } | | 37 | } | |
38 | EnumDefinition { | 38 | EnumDefinition { |
39 | kw<"enum"> RelationName | 39 | kw<"enum"> RelationName |
40 | (EnumBody { "{" sep<",", IndividualNodeName> "}" } | ".") | 40 | (EnumBody { "{" sep<",", AtomNodeName> "}" } | ".") |
41 | } | | 41 | } | |
42 | PredicateDefinition { | 42 | PredicateDefinition { |
43 | ( | 43 | ( |
@@ -56,8 +56,11 @@ statement { | |||
56 | // RuleName ParameterList<Parameter>? | 56 | // RuleName ParameterList<Parameter>? |
57 | // RuleBody { ":" sep<OrOp, Conjunction> "==>" sep<OrOp, Consequent> "." } | 57 | // RuleBody { ":" sep<OrOp, Conjunction> "==>" sep<OrOp, Consequent> "." } |
58 | //} | | 58 | //} | |
59 | IndividualDeclaration { | 59 | AtomDeclaration { |
60 | kw<"indiv"> sep<",", IndividualNodeName> "." | 60 | ckw<"atom"> sep<",", AtomNodeName> "." |
61 | } | | ||
62 | NodeDeclaration { | ||
63 | (ckw<"node"> | ckw<"multi">) sep<",", NodeName> "." | ||
61 | } | | 64 | } | |
62 | ScopeDeclaration { | 65 | ScopeDeclaration { |
63 | kw<"scope"> sep<",", ScopeElement> "." | 66 | kw<"scope"> sep<",", ScopeElement> "." |
@@ -161,7 +164,7 @@ RelationName { QualifiedName ~name } | |||
161 | 164 | ||
162 | //RuleName { QualifiedName } | 165 | //RuleName { QualifiedName } |
163 | 166 | ||
164 | IndividualNodeName { QualifiedName } | 167 | AtomNodeName { QualifiedName } |
165 | 168 | ||
166 | VariableName[@dynamicPrecedence=10] { QualifiedName ~name } | 169 | VariableName[@dynamicPrecedence=10] { QualifiedName ~name } |
167 | 170 | ||