aboutsummaryrefslogtreecommitdiffstats
path: root/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/ApplicationConfiguration.xtext
diff options
context:
space:
mode:
Diffstat (limited to 'Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/ApplicationConfiguration.xtext')
-rw-r--r--Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/ApplicationConfiguration.xtext406
1 files changed, 279 insertions, 127 deletions
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/ApplicationConfiguration.xtext b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/ApplicationConfiguration.xtext
index 6af31723..be1ac662 100644
--- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/ApplicationConfiguration.xtext
+++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/ApplicationConfiguration.xtext
@@ -2,180 +2,332 @@ grammar hu.bme.mit.inf.dslreasoner.application.ApplicationConfiguration with org
2 2
3import "http://www.eclipse.org/emf/2002/Ecore" as ecore 3import "http://www.eclipse.org/emf/2002/Ecore" as ecore
4import "http://www.eclipse.org/viatra/query/patternlanguage/emf/PatternLanguage" as viatra 4import "http://www.eclipse.org/viatra/query/patternlanguage/emf/PatternLanguage" as viatra
5import "http://www.bme.hu/mit/inf/dslreasoner/faulttree/components/CftLanguage" as cftLanguage
5generate applicationConfiguration "http://www.bme.hu/mit/inf/dslreasoner/application/ApplicationConfiguration" 6generate applicationConfiguration "http://www.bme.hu/mit/inf/dslreasoner/application/ApplicationConfiguration"
6 7
7ConfigurationScript: 8ConfigurationScript:
8 (imports += Import)* 9 (imports+=Import)*
9 (commands += Command)* 10 (commands+=Command)*;
10;
11 11
12Command : 12Command:
13 Declaration | Task 13 Declaration | Task;
14;
15 14
16QualifiedName returns ecore::EString: 15QualifiedName returns ecore::EString:
17 ID ('.' ID)*; 16 ID ('.' ID)*;
18REALLiteral returns ecore::EBigDecimal: '-'? INT '.' INT; 17
19INTLiteral returns ecore::EInt: '-'? INT; 18REALLiteral returns ecore::EBigDecimal:
19 '-'? INT '.' INT;
20
21INTLiteral returns ecore::EInt:
22 '-'? INT;
20 23
21/////////////////////////////////////////////////// 24///////////////////////////////////////////////////
22// Imports 25// Imports
23/////////////////////////////////////////////////// 26///////////////////////////////////////////////////
27Import:
28 EPackageImport | ViatraImport | CftImport;
29
30EPackageImport:
31 "import" "epackage" importedPackage=[ecore::EPackage|STRING];
24 32
25Import: EPackageImport | ViatraImport; 33ViatraImport:
34 "import" "viatra" importedViatra=[viatra::PatternModel|STRING];
26 35
27EPackageImport: "import" "epackage" importedPackage=[ecore::EPackage|STRING]; 36CftImport:
28ViatraImport: "import" "viatra" importedViatra=[viatra::PatternModel|STRING]; 37 "import" "reliability" importedCft=[cftLanguage::CftModel|STRING];
29 38
30/////////////////////////////////////////////////// 39///////////////////////////////////////////////////
31// Declaration 40// Declaration
32/////////////////////////////////////////////////// 41///////////////////////////////////////////////////
33 42Declaration:
34Declaration :
35 FileDeclaration 43 FileDeclaration
36 | MetamodelDeclaration 44 | MetamodelDeclaration
37 | PartialModelDeclaration 45 | PartialModelDeclaration
38 | GraphPatternDeclaration 46 | GraphPatternDeclaration
39 | ConfigDeclaration 47 | ConfigDeclaration
40 | ScopeDeclaration 48 | ScopeDeclaration
41; 49 | ObjectiveDeclaration;
42 50
43/////////////////////////////////////////////////// 51///////////////////////////////////////////////////
44// Files and Folders 52// Files and Folders
45/////////////////////////////////////////////////// 53///////////////////////////////////////////////////
54FileSpecification:
55 path=STRING;
46 56
47FileSpecification: path = STRING; 57FileDeclaration:
48FileDeclaration: 'file' name = ID '=' specification = FileSpecification; 58 'file' name=ID '=' specification=FileSpecification;
49FileReference: referred = [FileDeclaration]; 59
50File: FileSpecification | FileReference; 60FileReference:
61 referred=[FileDeclaration];
62
63File:
64 FileSpecification | FileReference;
51 65
52/////////////////////////////////////////////////// 66///////////////////////////////////////////////////
53// Metamodel 67// Metamodel
54/////////////////////////////////////////////////// 68///////////////////////////////////////////////////
69MetamodelSpecification:
70 '{' (entries+=MetamodelEntry) (',' entries+=MetamodelEntry)* '}';
71
72MetamodelEntry:
73 MetamodelElement | AllPackageEntry;
74
75AllPackageEntry:
76 "package" package=[ecore::EPackage|QualifiedName] ("excluding" '{' exclusion+=MetamodelElement (','
77 exclusion+=MetamodelElement)* '}')?;
78
79MetamodelElement:
80 (package=[ecore::EPackage|QualifiedName] '::')? classifier=[ecore::EClassifier] ('.'
81 feature=[ecore::ENamedElement])?;
55 82
56MetamodelSpecification: '{' (entries += MetamodelEntry) (',' entries += MetamodelEntry)* '}'; 83MetamodelDeclaration:
57MetamodelEntry: MetamodelElement | AllPackageEntry; 84 'metamodel' name=ID specification=MetamodelSpecification;
58AllPackageEntry: "package" package=[ecore::EPackage|QualifiedName] ("excluding" '{'exclusion +=MetamodelElement (',' exclusion +=MetamodelElement)*'}')?;
59MetamodelElement: (package=[ecore::EPackage|QualifiedName] '::')? classifier = [ecore::EClassifier] ('.' feature= [ecore::ENamedElement])?;
60 85
61MetamodelDeclaration: 'metamodel' name = ID specification = MetamodelSpecification; 86MetamodelReference:
62MetamodelReference: referred = [MetamodelDeclaration]; 87 referred=[MetamodelDeclaration];
63Metamodel: MetamodelReference | MetamodelSpecification; 88
89Metamodel:
90 MetamodelReference | MetamodelSpecification;
64 91
65/////////////////////////////////////////////////// 92///////////////////////////////////////////////////
66// Partial Model 93// Partial Model
67/////////////////////////////////////////////////// 94///////////////////////////////////////////////////
95PartialModelSpecification:
96 '{' entry+=PartialModelEntry (',' entry+=PartialModelEntry)? '}';
97
98PartialModelEntry:
99 ModelEntry | FolderEntry;
100
101ModelEntry:
102 path=File;
103
104FolderEntry:
105 "folder" path=File ("excluding" "{" exclusion+=ModelEntry ("," exclusion+=ModelEntry)* "}")?;
106
107PartialModelDeclaration:
108 'models' name=ID specification=PartialModelSpecification;
68 109
69PartialModelSpecification: '{' entry += PartialModelEntry (',' entry += PartialModelEntry)? '}'; 110PartialModelReference:
70PartialModelEntry: ModelEntry | FolderEntry; 111 referred=[PartialModelDeclaration];
71ModelEntry: path = File;
72FolderEntry: "folder" path = File ("excluding" "{" exclusion += ModelEntry ("," exclusion += ModelEntry)* "}")?;
73 112
74PartialModelDeclaration: 'models' name = ID specification = PartialModelSpecification; 113PartialModel:
75PartialModelReference : referred = [PartialModelDeclaration]; 114 PartialModelSpecification | PartialModelReference;
76PartialModel: PartialModelSpecification | PartialModelReference;
77 115
78/////////////////////////////////////////////////// 116///////////////////////////////////////////////////
79// Patterns 117// Patterns
80/////////////////////////////////////////////////// 118///////////////////////////////////////////////////
119PatternSpecification:
120 '{' entries+=PatternEntry (',' entries+=PatternEntry)* '}';
121
122PatternEntry:
123 PatternElement | AllPatternEntry;
124
125AllPatternEntry:
126 'package' package=[viatra::PatternModel|QualifiedName] ('excluding' '{' exclusuion+=PatternElement (','
127 exclusuion+=PatternElement)* '}')?;
128
129PatternElement:
130 (package=[viatra::PatternModel|QualifiedName] '::')? pattern=[viatra::Pattern];
131
132GraphPatternDeclaration:
133 'constraints' name=ID specification=PatternSpecification;
134
135GraphPatternReference:
136 referred=[GraphPatternDeclaration];
137
138GraphPattern:
139 GraphPatternReference | PatternSpecification;
140
141///////////////////////////////////////////////////
142// Objectives
143///////////////////////////////////////////////////
144ObjectiveSpecification:
145 '{' entries+=ObjectiveEntry (',' entries+=ObjectiveEntry)* '}';
146
147ObjectiveEntry:
148 OptimizationEntry | ThresholdEntry;
149
150enum OptimizationDirection:
151 MINIMIZE='minimize' | MAXIMIZE='maximize';
152
153OptimizationEntry:
154 direction=OptimizationDirection function=ObjectiveFunction;
155
156enum ComparisonOperator:
157 LESS='<' | GREATER='>' | LESS_EQUALS='<=' | GREATER_EQUALS='>=';
158
159ThresholdEntry:
160 function=ObjectiveFunction operator=ComparisonOperator threshold=REALLiteral;
81 161
82PatternSpecification: '{' entries += PatternEntry (',' entries += PatternEntry)* '}'; 162ObjectiveFunction:
83PatternEntry: PatternElement | AllPatternEntry; 163 CostObjectiveFunction | ReliabilityObjectiveFunction;
84AllPatternEntry: 'package' package = [viatra::PatternModel|QualifiedName] ('excluding' '{' exclusuion += PatternElement (',' exclusuion += PatternElement)* '}')?;
85PatternElement: (package =[viatra::PatternModel|QualifiedName] '::')? pattern = [viatra::Pattern];
86 164
87GraphPatternDeclaration: 'constraints' name = ID specification = PatternSpecification; 165CostObjectiveFunction:
88GraphPatternReference: referred = [GraphPatternDeclaration]; 166 'cost' '{' entries+=CostEntry (',' entries+=CostEntry)* '}';
89GraphPattern: GraphPatternReference|PatternSpecification; 167
168CostEntry:
169 patternElement=PatternElement '=' weight=INTLiteral;
170
171ReliabilityObjectiveFunction:
172 ReliabiltiyProbability | Mtff;
173
174ReliabiltiyProbability:
175 'reliability' (package=[cftLanguage::CftModel|QualifiedName] '::')?
176 transformation=[cftLanguage::TransformationDefinition]
177 'at' time=REALLiteral;
178
179Mtff:
180 'mtff' (package=[cftLanguage::CftModel|QualifiedName] '::')? transformation=[cftLanguage::TransformationDefinition];
181
182ObjectiveDeclaration:
183 'objectives' name=ID specification=ObjectiveSpecification;
184
185ObjectiveReference:
186 referred=[ObjectiveDeclaration];
187
188Objective:
189 ObjectiveReference | ObjectiveSpecification;
90 190
91/////////////////////////////////////////////////// 191///////////////////////////////////////////////////
92// SolverConfig 192// SolverConfig
93/////////////////////////////////////////////////// 193///////////////////////////////////////////////////
194ConfigSpecification:
195 {ConfigSpecification} '{'
196 (entries+=ConfigEntry ("," entries+=ConfigEntry)*)?
197 '}';
198
199ConfigDeclaration:
200 'config' name=ID specification=ConfigSpecification;
94 201
95ConfigSpecification: {ConfigSpecification}'{' 202ConfigEntry:
96 (entries += ConfigEntry ("," entries += ConfigEntry)*)? 203 DocumentationEntry | RuntimeEntry | MemoryEntry | CustomEntry;
204
205DocumentationEntry:
206 "log-level" '=' level=DocumentLevelSpecification;
207
208enum DocumentLevelSpecification:
209 none | normal | full;
210
211RuntimeEntry:
212 "runtime" "=" millisecLimit=INT;
213
214MemoryEntry:
215 "memory" "=" megabyteLimit=INT;
216
217CustomEntry:
218 key=STRING "=" value=STRING;
219
220ConfigReference:
221 config=[ConfigDeclaration];
222
223Config:
224 ConfigSpecification | ConfigReference;
225
226enum Solver:
227 SMTSolver | AlloySolver | ViatraSolver;
228
229ScopeSpecification:
230 {ScopeSpecification} '{'
231 (scopes+=TypeScope (',' scopes+=TypeScope)*)?
97 '}'; 232 '}';
98ConfigDeclaration : 233
99 'config' name = ID specification = ConfigSpecification 234TypeScope:
100; 235 ClassTypeScope | ObjectTypeScope | IntegerTypeScope | RealTypeScope | StringTypeScope;
101ConfigEntry: DocumentationEntry | RuntimeEntry | MemoryEntry | CustomEntry; 236
102DocumentationEntry: "log-level" '=' level = DocumentLevelSpecification; enum DocumentLevelSpecification: none | normal | full; 237ClassTypeScope:
103RuntimeEntry: "runtime" "=" millisecLimit = INT; 238 '#' type=ClassReference
104MemoryEntry: "memory" "=" megabyteLimit = INT; 239 (setsNew?='+=' | setsSum?='=')
105CustomEntry: key = STRING "=" value = STRING; 240 (number=ExactNumber | number=IntervallNumber);
106 241
107ConfigReference: config = [ConfigDeclaration]; 242ObjectTypeScope:
108Config: ConfigSpecification | ConfigReference; 243 '#' type=ObjectReference
109 244 (setsNew?='+=' | setsSum?='=')
110enum Solver: SMTSolver | AlloySolver | ViatraSolver; 245 (number=ExactNumber | number=IntervallNumber);
111 246
112ScopeSpecification: {ScopeSpecification} '{' 247IntegerTypeScope:
113 (scopes += TypeScope (',' scopes += TypeScope)*)? 248 '#' type=IntegerReference
114'}'; 249 (setsNew?='+=' | setsSum?='=')
115TypeScope: ClassTypeScope | ObjectTypeScope | IntegerTypeScope | RealTypeScope | StringTypeScope; 250 (number=ExactNumber | number=IntervallNumber | number=IntEnumberation);
116ClassTypeScope: '#' type = ClassReference 251
117 (setsNew ?='+=' | setsSum ?= '=') 252RealTypeScope:
118 (number = ExactNumber | number = IntervallNumber) 253 '#' type=RealReference
119; 254 (setsNew?='+=' | setsSum?='=')
120ObjectTypeScope: '#' type = ObjectReference 255 (number=ExactNumber | number=IntervallNumber | number=RealEnumeration);
121 (setsNew ?='+=' | setsSum ?= '=') 256
122 (number = ExactNumber | number = IntervallNumber) 257StringTypeScope:
123; 258 '#' type=StringReference
124IntegerTypeScope: '#' type = IntegerReference 259 (setsNew?='+=' | setsSum?='=')
125 (setsNew ?='+=' | setsSum ?= '=') 260 (number=ExactNumber | number=IntervallNumber | number=StringEnumeration);
126 (number = ExactNumber | number = IntervallNumber | number = IntEnumberation) 261
127; 262TypeReference:
128RealTypeScope: '#' type = RealReference 263 ClassReference | ObjectReference | IntegerReference | RealReference | StringReference;
129 (setsNew ?='+=' | setsSum ?= '=') 264
130 (number = ExactNumber | number = IntervallNumber | number = RealEnumeration) 265ClassReference:
131; 266 '<' element=MetamodelElement '>';
132StringTypeScope: '#' type = StringReference 267
133 (setsNew ?='+=' | setsSum ?= '=') 268ObjectReference:
134 (number = ExactNumber | number = IntervallNumber | number = StringEnumeration) 269 {ObjectReference} 'node';
135; 270
136 271IntegerReference:
137TypeReference: ClassReference | ObjectReference | IntegerReference | RealReference | StringReference; 272 {IntegerScope} 'int';
138ClassReference: '<' element = MetamodelElement '>'; 273
139ObjectReference: {ObjectReference} 'node'; 274RealReference:
140IntegerReference: {IntegerScope} 'int'; 275 {RealScope} 'real';
141RealReference: {RealScope} 'real'; 276
142StringReference: {StringScope} 'string'; 277StringReference:
143 278 {StringScope} 'string';
144NumberSpecification: ExactNumber | IntervallNumber | IntEnumberation | RealEnumeration | StringEnumeration; 279
145ExactNumber: exactNumber = INT | exactUnlimited ?= '*'; 280NumberSpecification:
146IntervallNumber: min = INT '..' (maxNumber = INT | maxUnlimited ?= '*'); 281 ExactNumber | IntervallNumber | IntEnumberation | RealEnumeration | StringEnumeration;
147IntEnumberation: {IntEnumberation} '{' (entry += INTLiteral (',' entry += INTLiteral)*)?'}'; 282
148RealEnumeration: {RealEnumeration} '{' (entry += REALLiteral (',' entry += REALLiteral)*)?'}'; 283ExactNumber:
149StringEnumeration: {StringEnumeration} '{' (entry += STRING (',' entry += STRING)*)?'}'; 284 exactNumber=INT | exactUnlimited?='*';
150 285
151ScopeDeclaration: 'scope' name = ID specification = ScopeSpecification; 286IntervallNumber:
152ScopeReference: referred = [ScopeDeclaration]; 287 min=INT '..' (maxNumber=INT | maxUnlimited?='*');
153Scope: ScopeSpecification | ScopeReference; 288
154 289IntEnumberation:
155Task: GenerationTask /*| CoverageCalculation | ValidationTask*/; 290 {IntEnumberation} '{' (entry+=INTLiteral (',' entry+=INTLiteral)*)? '}';
156 291
157GenerationTask: 'generate' {GenerationTask} '{'( 292RealEnumeration:
158 293 {RealEnumeration} '{' (entry+=REALLiteral (',' entry+=REALLiteral)*)? '}';
159 // domain 294
160 ('metamodel' '=' metamodel = Metamodel)? & 295StringEnumeration:
161 ('partial-model' '=' partialModel = PartialModel)? & 296 {StringEnumeration} '{' (entry+=STRING (',' entry+=STRING)*)? '}';
162 ('constraints' '=' patterns = GraphPattern)? & 297
163 298ScopeDeclaration:
164 // model set 299 'scope' name=ID specification=ScopeSpecification;
165 ('scope' '=' scope = Scope)? & 300
166 (numberSpecified ?= 'number' '=' number= INT)? & 301ScopeReference:
167 (runSpecified ?= 'runs' '=' runs = INT)? & 302 referred=[ScopeDeclaration];
168 // Solver 303
169 ('solver' '=' solver = Solver)? & 304Scope:
170 ('config' '=' config = Config)? & 305 ScopeSpecification | ScopeReference;
171 306
172 // output texts 307Task:
173 ('debug' '=' debugFolder = File)? & 308 GenerationTask /*| CoverageCalculation | ValidationTask*/;
174 ('log' '=' targetLogFile = File)? & 309
175 ('statistics' '=' targetStatisticsFile = File)? & 310GenerationTask:
176 311 'generate' {GenerationTask} '{' (
177 // output models 312
178 ('output' '=' tagetFolder = File)? 313 // domain
179 314 ('metamodel' '=' metamodel=Metamodel)? &
180 )'}' 315 ('partial-model' '=' partialModel=PartialModel)? &
181; \ No newline at end of file 316 ('constraints' '=' patterns=GraphPattern)? &
317 ('objectives' '=' objectives=Objective)? &
318
319 // model set
320 ('scope' '=' scope=Scope)? &
321 (numberSpecified?='number' '=' number=INT)? &
322 (runSpecified?='runs' '=' runs=INT)? &
323 // Solver
324 ('solver' '=' solver=Solver)? &
325 ('config' '=' config=Config)? &
326
327 // output texts
328 ('debug' '=' debugFolder=File)? &
329 ('log' '=' targetLogFile=File)? &
330 ('statistics' '=' targetStatisticsFile=File)? &
331
332 // output models
333 ('output' '=' tagetFolder=File)?) '}'; \ No newline at end of file