blob: 6af317236ee26aae4b282d0e3ea39e17bf5b2f53 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
grammar hu.bme.mit.inf.dslreasoner.application.ApplicationConfiguration with org.eclipse.xtext.common.Terminals
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
import "http://www.eclipse.org/viatra/query/patternlanguage/emf/PatternLanguage" as viatra
generate applicationConfiguration "http://www.bme.hu/mit/inf/dslreasoner/application/ApplicationConfiguration"
ConfigurationScript:
(imports += Import)*
(commands += Command)*
;
Command :
Declaration | Task
;
QualifiedName returns ecore::EString:
ID ('.' ID)*;
REALLiteral returns ecore::EBigDecimal: '-'? INT '.' INT;
INTLiteral returns ecore::EInt: '-'? INT;
///////////////////////////////////////////////////
// Imports
///////////////////////////////////////////////////
Import: EPackageImport | ViatraImport;
EPackageImport: "import" "epackage" importedPackage=[ecore::EPackage|STRING];
ViatraImport: "import" "viatra" importedViatra=[viatra::PatternModel|STRING];
///////////////////////////////////////////////////
// Declaration
///////////////////////////////////////////////////
Declaration :
FileDeclaration
| MetamodelDeclaration
| PartialModelDeclaration
| GraphPatternDeclaration
| ConfigDeclaration
| ScopeDeclaration
;
///////////////////////////////////////////////////
// Files and Folders
///////////////////////////////////////////////////
FileSpecification: path = STRING;
FileDeclaration: 'file' name = ID '=' specification = FileSpecification;
FileReference: referred = [FileDeclaration];
File: FileSpecification | FileReference;
///////////////////////////////////////////////////
// Metamodel
///////////////////////////////////////////////////
MetamodelSpecification: '{' (entries += MetamodelEntry) (',' entries += MetamodelEntry)* '}';
MetamodelEntry: MetamodelElement | AllPackageEntry;
AllPackageEntry: "package" package=[ecore::EPackage|QualifiedName] ("excluding" '{'exclusion +=MetamodelElement (',' exclusion +=MetamodelElement)*'}')?;
MetamodelElement: (package=[ecore::EPackage|QualifiedName] '::')? classifier = [ecore::EClassifier] ('.' feature= [ecore::ENamedElement])?;
MetamodelDeclaration: 'metamodel' name = ID specification = MetamodelSpecification;
MetamodelReference: referred = [MetamodelDeclaration];
Metamodel: MetamodelReference | MetamodelSpecification;
///////////////////////////////////////////////////
// Partial Model
///////////////////////////////////////////////////
PartialModelSpecification: '{' entry += PartialModelEntry (',' entry += PartialModelEntry)? '}';
PartialModelEntry: ModelEntry | FolderEntry;
ModelEntry: path = File;
FolderEntry: "folder" path = File ("excluding" "{" exclusion += ModelEntry ("," exclusion += ModelEntry)* "}")?;
PartialModelDeclaration: 'models' name = ID specification = PartialModelSpecification;
PartialModelReference : referred = [PartialModelDeclaration];
PartialModel: PartialModelSpecification | PartialModelReference;
///////////////////////////////////////////////////
// Patterns
///////////////////////////////////////////////////
PatternSpecification: '{' entries += PatternEntry (',' entries += PatternEntry)* '}';
PatternEntry: PatternElement | AllPatternEntry;
AllPatternEntry: 'package' package = [viatra::PatternModel|QualifiedName] ('excluding' '{' exclusuion += PatternElement (',' exclusuion += PatternElement)* '}')?;
PatternElement: (package =[viatra::PatternModel|QualifiedName] '::')? pattern = [viatra::Pattern];
GraphPatternDeclaration: 'constraints' name = ID specification = PatternSpecification;
GraphPatternReference: referred = [GraphPatternDeclaration];
GraphPattern: GraphPatternReference|PatternSpecification;
///////////////////////////////////////////////////
// SolverConfig
///////////////////////////////////////////////////
ConfigSpecification: {ConfigSpecification}'{'
(entries += ConfigEntry ("," entries += ConfigEntry)*)?
'}';
ConfigDeclaration :
'config' name = ID specification = ConfigSpecification
;
ConfigEntry: DocumentationEntry | RuntimeEntry | MemoryEntry | CustomEntry;
DocumentationEntry: "log-level" '=' level = DocumentLevelSpecification; enum DocumentLevelSpecification: none | normal | full;
RuntimeEntry: "runtime" "=" millisecLimit = INT;
MemoryEntry: "memory" "=" megabyteLimit = INT;
CustomEntry: key = STRING "=" value = STRING;
ConfigReference: config = [ConfigDeclaration];
Config: ConfigSpecification | ConfigReference;
enum Solver: SMTSolver | AlloySolver | ViatraSolver;
ScopeSpecification: {ScopeSpecification} '{'
(scopes += TypeScope (',' scopes += TypeScope)*)?
'}';
TypeScope: ClassTypeScope | ObjectTypeScope | IntegerTypeScope | RealTypeScope | StringTypeScope;
ClassTypeScope: '#' type = ClassReference
(setsNew ?='+=' | setsSum ?= '=')
(number = ExactNumber | number = IntervallNumber)
;
ObjectTypeScope: '#' type = ObjectReference
(setsNew ?='+=' | setsSum ?= '=')
(number = ExactNumber | number = IntervallNumber)
;
IntegerTypeScope: '#' type = IntegerReference
(setsNew ?='+=' | setsSum ?= '=')
(number = ExactNumber | number = IntervallNumber | number = IntEnumberation)
;
RealTypeScope: '#' type = RealReference
(setsNew ?='+=' | setsSum ?= '=')
(number = ExactNumber | number = IntervallNumber | number = RealEnumeration)
;
StringTypeScope: '#' type = StringReference
(setsNew ?='+=' | setsSum ?= '=')
(number = ExactNumber | number = IntervallNumber | number = StringEnumeration)
;
TypeReference: ClassReference | ObjectReference | IntegerReference | RealReference | StringReference;
ClassReference: '<' element = MetamodelElement '>';
ObjectReference: {ObjectReference} 'node';
IntegerReference: {IntegerScope} 'int';
RealReference: {RealScope} 'real';
StringReference: {StringScope} 'string';
NumberSpecification: ExactNumber | IntervallNumber | IntEnumberation | RealEnumeration | StringEnumeration;
ExactNumber: exactNumber = INT | exactUnlimited ?= '*';
IntervallNumber: min = INT '..' (maxNumber = INT | maxUnlimited ?= '*');
IntEnumberation: {IntEnumberation} '{' (entry += INTLiteral (',' entry += INTLiteral)*)?'}';
RealEnumeration: {RealEnumeration} '{' (entry += REALLiteral (',' entry += REALLiteral)*)?'}';
StringEnumeration: {StringEnumeration} '{' (entry += STRING (',' entry += STRING)*)?'}';
ScopeDeclaration: 'scope' name = ID specification = ScopeSpecification;
ScopeReference: referred = [ScopeDeclaration];
Scope: ScopeSpecification | ScopeReference;
Task: GenerationTask /*| CoverageCalculation | ValidationTask*/;
GenerationTask: 'generate' {GenerationTask} '{'(
// domain
('metamodel' '=' metamodel = Metamodel)? &
('partial-model' '=' partialModel = PartialModel)? &
('constraints' '=' patterns = GraphPattern)? &
// model set
('scope' '=' scope = Scope)? &
(numberSpecified ?= 'number' '=' number= INT)? &
(runSpecified ?= 'runs' '=' runs = INT)? &
// Solver
('solver' '=' solver = Solver)? &
('config' '=' config = Config)? &
// output texts
('debug' '=' debugFolder = File)? &
('log' '=' targetLogFile = File)? &
('statistics' '=' targetStatisticsFile = File)? &
// output models
('output' '=' tagetFolder = File)?
)'}'
;
|