diff options
Diffstat (limited to 'Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.components/src/hu/bme/mit/inf/dslreasoner/faulttree/components/CftLanguage.xtext')
-rw-r--r-- | Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.components/src/hu/bme/mit/inf/dslreasoner/faulttree/components/CftLanguage.xtext | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.components/src/hu/bme/mit/inf/dslreasoner/faulttree/components/CftLanguage.xtext b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.components/src/hu/bme/mit/inf/dslreasoner/faulttree/components/CftLanguage.xtext deleted file mode 100644 index ab053f67..00000000 --- a/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.components/src/hu/bme/mit/inf/dslreasoner/faulttree/components/CftLanguage.xtext +++ /dev/null | |||
@@ -1,101 +0,0 @@ | |||
1 | grammar hu.bme.mit.inf.dslreasoner.faulttree.components.CftLanguage with org.eclipse.xtext.common.Terminals | ||
2 | |||
3 | import "http://www.eclipse.org/emf/2002/Ecore" as ecore | ||
4 | import "http://www.eclipse.org/viatra/query/patternlanguage/emf/PatternLanguage" as vql | ||
5 | import "http://www.bme.hu/mit/inf/dslreasoner/faulttree/model/ft" as ft | ||
6 | import "http://www.bme.hu/mit/inf/dslreasoner/faulttree/model/cft" as cft | ||
7 | generate cftLanguage "http://www.bme.hu/mit/inf/dslreasoner/faulttree/components/CftLanguage" | ||
8 | |||
9 | CftModel: | ||
10 | "package" packageName=QualifiedName ";"? | ||
11 | imports+=ImportDeclaration* | ||
12 | (componentDefinitions+=ComponentDefinition | transformationDefinitions+=TransformationDefinition)*; | ||
13 | |||
14 | ImportDeclaration: | ||
15 | "import" importedNamespace=QualifiedNameWithWildcard ";"?; | ||
16 | |||
17 | ComponentDefinition returns cft::ComponentDefinition: | ||
18 | "cft" name=ValidId "{" | ||
19 | (("in" inputEvents+=InputEvent* ";")? & ("out" outputEvents+=[cft::EventDeclaration|ValidId]* ";")?) | ||
20 | (eventDefinitions+=EventDefinition ";")* | ||
21 | "}"; | ||
22 | |||
23 | InputEvent returns cft::InputEvent: | ||
24 | name=ValidId multiple?="[]"?; | ||
25 | |||
26 | EventDefinition returns cft::EventDefinition: | ||
27 | BasicEventDefinition | GateDefinition; | ||
28 | |||
29 | BasicEventDefinition returns cft::BasicEventDefinition: | ||
30 | name=ValidId distribution=Distribution; | ||
31 | |||
32 | Distribution returns ft::Distribution: | ||
33 | ConstantDistribution | ExponentialDistribution; | ||
34 | |||
35 | ConstantDistribution returns ft::ConstantDistribution: | ||
36 | "prob" "=" p=Double; | ||
37 | |||
38 | ExponentialDistribution returns ft::ExponentialDistribution: | ||
39 | "lambda" "=" lambda=Double; | ||
40 | |||
41 | GateDefinition returns cft::GateDefinition: | ||
42 | AndGateDefinition | OrGateDefinition | KOfMGateDefinition; | ||
43 | |||
44 | AndGateDefinition returns cft::AndGateDefinition: | ||
45 | name=ValidId "and" inputEvents+=[cft::EventDeclaration|ValidId]*; | ||
46 | |||
47 | OrGateDefinition returns cft::OrGateDefinition: | ||
48 | name=ValidId "or" inputEvents+=[cft::EventDeclaration|ValidId]*; | ||
49 | |||
50 | KOfMGateDefinition returns cft::KOfMGateDefinition: | ||
51 | name=ValidId k=INT ("of" m=INT | m=OF_INT) inputEvents+=[cft::EventDeclaration|ValidId]*; | ||
52 | |||
53 | TransformationDefinition: | ||
54 | "transformation" name=ValidId "{" | ||
55 | mappingDefinitions+=MappingDefinition* | ||
56 | "}"; | ||
57 | |||
58 | MappingDefinition: | ||
59 | topLevel?="toplevel"? "mapping" pattern=[vql::Pattern|QualifiedName] | ||
60 | "(" parameters+=MappingParameter ("," parameters+=MappingParameter)* ")" | ||
61 | (componentInstance=ComponentInstance)? ("{" | ||
62 | ((lookupDefinitions+=LookupDefinition | assignments+=Assignment) ";")* | ||
63 | "}")?; | ||
64 | |||
65 | MappingParameter: | ||
66 | name=ValidId; | ||
67 | |||
68 | LookupDefinition: | ||
69 | "lookup" mapping=[MappingDefinition|QualifiedName] | ||
70 | "(" arguments+=[MappingParameter|ValidId] ("," arguments+=[MappingParameter|ValidId])* ")" | ||
71 | "as" name=ValidId; | ||
72 | |||
73 | Variable: | ||
74 | ComponentInstance | LookupDefinition; | ||
75 | |||
76 | Assignment: | ||
77 | input=EventReference (multiple?="+=" | ":=") output=EventReference; | ||
78 | |||
79 | EventReference: | ||
80 | component=[Variable|ValidId] "." event=[cft::EventDeclaration|ValidId]; | ||
81 | |||
82 | ComponentInstance: | ||
83 | "=>" componentType=[cft::ComponentDefinition|QualifiedName] name=ValidId?; | ||
84 | |||
85 | QualifiedName returns ecore::EString: | ||
86 | ValidId ("." ValidId)*; | ||
87 | |||
88 | QualifiedNameWithWildcard returns ecore::EString: | ||
89 | QualifiedName ("." "*")?; | ||
90 | |||
91 | ValidId: | ||
92 | ID | OF_INT; | ||
93 | |||
94 | Double returns ecore::EDouble: | ||
95 | INT | T_DOUBLE; | ||
96 | |||
97 | terminal OF_INT returns ecore::EInt: | ||
98 | "o" "f" ('0'..'9')+; | ||
99 | |||
100 | terminal T_DOUBLE: | ||
101 | ('0'..'9')+ ("." ('0'..'9')+ | ("." ('0'..'9')+)? ("e" | "E") ("+" | "-")? ('0'..'9')+); | ||