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