diff options
Diffstat (limited to 'Application/org.eclipse.viatra.solver.language/src/org/eclipse/viatra')
-rw-r--r-- | Application/org.eclipse.viatra.solver.language/src/org/eclipse/viatra/solver/language/SolverLanguage.xtext | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/Application/org.eclipse.viatra.solver.language/src/org/eclipse/viatra/solver/language/SolverLanguage.xtext b/Application/org.eclipse.viatra.solver.language/src/org/eclipse/viatra/solver/language/SolverLanguage.xtext index 17a329ad..8a510a19 100644 --- a/Application/org.eclipse.viatra.solver.language/src/org/eclipse/viatra/solver/language/SolverLanguage.xtext +++ b/Application/org.eclipse.viatra.solver.language/src/org/eclipse/viatra/solver/language/SolverLanguage.xtext | |||
@@ -18,7 +18,7 @@ TruthValue: {True} 'true' | {False} 'false' | {Unknown} 'unknown' | {Error} ' | |||
18 | /////////////////// | 18 | /////////////////// |
19 | Interpretation: BasicInterpretation | DefaultInterpretation | CDInterpretation; | 19 | Interpretation: BasicInterpretation | DefaultInterpretation | CDInterpretation; |
20 | 20 | ||
21 | BasicInterpretation: symbol=Symbol '(' objects+=ComplexObject* ')' ':' value = TruthValue; | 21 | BasicInterpretation: symbol=Symbol ('(' (objects+=ComplexObject (',' objects+=ComplexObject)*)? ')')? ':' value = TruthValue; |
22 | 22 | ||
23 | Symbol: ModelSymbol | PartialitySymbol | DataSymbol; | 23 | Symbol: ModelSymbol | PartialitySymbol | DataSymbol; |
24 | 24 | ||
@@ -48,22 +48,20 @@ StringObject: value = STRING; | |||
48 | /////////////////// | 48 | /////////////////// |
49 | // Predicte grammar | 49 | // Predicte grammar |
50 | /////////////////// | 50 | /////////////////// |
51 | Predicate: PredicateSymbol | ErrorPredicate; | 51 | |
52 | PredicateSymbol: | 52 | Predicate: |
53 | 'predicate' symbol = ModelSymbol '(' parameters += Parameter* ')' ':' ('false' | (bodies += PatternBody ('|' bodies += PatternBody)*)) '.' | 53 | (isError?='error')? symbol = ModelSymbol ('(' (parameters += Parameter (',' parameters += Parameter)*)? ')')? ':-' ('false' | (bodies += PatternBody ('|' bodies += PatternBody)*)) '.' |
54 | ; | ||
55 | ErrorPredicate: | ||
56 | {ErrorPredicate} 'error' (name = ID)? ('(' parameters += Parameter* ')') ':' ('false' | (bodies += PatternBody ('|' bodies += PatternBody)*)) '.' | ||
57 | ; | 54 | ; |
58 | 55 | ||
59 | Parameter: variable = Variable (':' type = Symbol)?; | 56 | Parameter: variable = Variable (':' type = Symbol)?; |
60 | PatternBody: {PatternBody} ('true' | constraints += Constraint*) ; | 57 | PatternBody: {PatternBody} ('true' | constraints += Constraint*) ; |
61 | Polarity: {Positive} '+' | {Negative} '-'; | 58 | Polarity: {Positive} '+' | {Negative} '-'; |
62 | Constraint: (polarity = Polarity)? symbol = ModelSymbol ( | 59 | Constraint: (polarity = Polarity)? symbol = ModelSymbol |
63 | ( '(' params += Literal* ')') | (closureType = ClosureType '(' params += Literal params += Literal ')')); | 60 | (('(' params += Literal? (',' params += Literal)* ')')?) |
64 | 61 | | | |
62 | (closureType=ClosureType '(' params += Literal? (',' params += Literal)* ')'); | ||
65 | ClosureType: {ReflexiveClosure} '*' | {IrreflexiveClosure} '+'; | 63 | ClosureType: {ReflexiveClosure} '*' | {IrreflexiveClosure} '+'; |
66 | Literal: Variable | DataObject; | 64 | Literal: Variable | DataObject | NamedObject; |
67 | Variable: name = ID; | 65 | Variable: name = ID; |
68 | 66 | ||
69 | /////////////////// | 67 | /////////////////// |
@@ -83,13 +81,13 @@ DefaultInterpretation: 'default' interpretation = BasicInterpretation; | |||
83 | /////////////////// | 81 | /////////////////// |
84 | CDInterpretation: ClassInterpretation | EnumInterpretation| GlobalRelationInterpretation; | 82 | CDInterpretation: ClassInterpretation | EnumInterpretation| GlobalRelationInterpretation; |
85 | ClassInterpretation: | 83 | ClassInterpretation: |
86 | abstract?='abstract' 'class' symbol = ModelSymbol ('extends' supertypes += ModelSymbol+)?'{' | 84 | (abstract?='abstract')? 'class' symbol = ModelSymbol ('extends' supertypes += ModelSymbol+)?'{' |
87 | fielt += FieldRelationInterpretation* | 85 | fielt += FieldRelationInterpretation* |
88 | '}' | 86 | '}' |
89 | ; | 87 | ; |
90 | EnumInterpretation: 'enum' Symbol = ModelSymbol '{' objects+=NamedObject+ '}'; | 88 | EnumInterpretation: 'enum' Symbol = ModelSymbol '{' objects+=NamedObject+ '}'; |
91 | FieldRelationInterpretation: containment ?= 'containment' symbol = ModelSymbol ':' multiplicity = MultiplicityDefinition? target = Symbol; | 89 | FieldRelationInterpretation: (containment ?= 'containment')? symbol = ModelSymbol ':' multiplicity = MultiplicityDefinition? target = Symbol; |
92 | GlobalRelationInterpretation: containment ?= 'containment' 'relation' symbol = ModelSymbol ':' sourceMultiplicity = MultiplicityDefinition? source = Symbol targetMultiplicity = MultiplicityDefinition? target = Symbol; | 90 | GlobalRelationInterpretation: (containment ?= 'containment')? 'relation' symbol = ModelSymbol ':' sourceMultiplicity = MultiplicityDefinition? source = Symbol targetMultiplicity = MultiplicityDefinition? target = Symbol; |
93 | MultiplicityDefinition: lower = INT '..' (upper = INT | unlimitedUpper?='*'); | 91 | MultiplicityDefinition: lower = INT '..' (upper = INT | unlimitedUpper?='*'); |
94 | 92 | ||
95 | ////SymbolIntroduction : Type | GlobalRelation | Predicate; | 93 | ////SymbolIntroduction : Type | GlobalRelation | Predicate; |