From 820151b6d27643ba0927ca84d1bccadbd695a55d Mon Sep 17 00:00:00 2001 From: Oszkar Semerath Date: Wed, 6 May 2020 00:27:55 +0200 Subject: PS language update --- .../viatra/solver/language/SolverLanguage.xtext | 26 ++++++++++------------ 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'Application/org.eclipse.viatra.solver.language/src/org/eclipse/viatra/solver/language/SolverLanguage.xtext') 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} ' /////////////////// Interpretation: BasicInterpretation | DefaultInterpretation | CDInterpretation; -BasicInterpretation: symbol=Symbol '(' objects+=ComplexObject* ')' ':' value = TruthValue; +BasicInterpretation: symbol=Symbol ('(' (objects+=ComplexObject (',' objects+=ComplexObject)*)? ')')? ':' value = TruthValue; Symbol: ModelSymbol | PartialitySymbol | DataSymbol; @@ -48,22 +48,20 @@ StringObject: value = STRING; /////////////////// // Predicte grammar /////////////////// -Predicate: PredicateSymbol | ErrorPredicate; -PredicateSymbol: - 'predicate' symbol = ModelSymbol '(' parameters += Parameter* ')' ':' ('false' | (bodies += PatternBody ('|' bodies += PatternBody)*)) '.' -; -ErrorPredicate: - {ErrorPredicate} 'error' (name = ID)? ('(' parameters += Parameter* ')') ':' ('false' | (bodies += PatternBody ('|' bodies += PatternBody)*)) '.' + +Predicate: + (isError?='error')? symbol = ModelSymbol ('(' (parameters += Parameter (',' parameters += Parameter)*)? ')')? ':-' ('false' | (bodies += PatternBody ('|' bodies += PatternBody)*)) '.' ; Parameter: variable = Variable (':' type = Symbol)?; PatternBody: {PatternBody} ('true' | constraints += Constraint*) ; Polarity: {Positive} '+' | {Negative} '-'; -Constraint: (polarity = Polarity)? symbol = ModelSymbol ( - ( '(' params += Literal* ')') | (closureType = ClosureType '(' params += Literal params += Literal ')')); - +Constraint: (polarity = Polarity)? symbol = ModelSymbol + (('(' params += Literal? (',' params += Literal)* ')')?) + | + (closureType=ClosureType '(' params += Literal? (',' params += Literal)* ')'); ClosureType: {ReflexiveClosure} '*' | {IrreflexiveClosure} '+'; -Literal: Variable | DataObject; +Literal: Variable | DataObject | NamedObject; Variable: name = ID; /////////////////// @@ -83,13 +81,13 @@ DefaultInterpretation: 'default' interpretation = BasicInterpretation; /////////////////// CDInterpretation: ClassInterpretation | EnumInterpretation| GlobalRelationInterpretation; ClassInterpretation: - abstract?='abstract' 'class' symbol = ModelSymbol ('extends' supertypes += ModelSymbol+)?'{' + (abstract?='abstract')? 'class' symbol = ModelSymbol ('extends' supertypes += ModelSymbol+)?'{' fielt += FieldRelationInterpretation* '}' ; EnumInterpretation: 'enum' Symbol = ModelSymbol '{' objects+=NamedObject+ '}'; -FieldRelationInterpretation: containment ?= 'containment' symbol = ModelSymbol ':' multiplicity = MultiplicityDefinition? target = Symbol; -GlobalRelationInterpretation: containment ?= 'containment' 'relation' symbol = ModelSymbol ':' sourceMultiplicity = MultiplicityDefinition? source = Symbol targetMultiplicity = MultiplicityDefinition? target = Symbol; +FieldRelationInterpretation: (containment ?= 'containment')? symbol = ModelSymbol ':' multiplicity = MultiplicityDefinition? target = Symbol; +GlobalRelationInterpretation: (containment ?= 'containment')? 'relation' symbol = ModelSymbol ':' sourceMultiplicity = MultiplicityDefinition? source = Symbol targetMultiplicity = MultiplicityDefinition? target = Symbol; MultiplicityDefinition: lower = INT '..' (upper = INT | unlimitedUpper?='*'); ////SymbolIntroduction : Type | GlobalRelation | Predicate; -- cgit v1.2.3-54-g00ecf