-
Notifications
You must be signed in to change notification settings - Fork 0
/
UCD.mc4
102 lines (94 loc) · 3.84 KB
/
UCD.mc4
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
/* (c) https://github.com/MontiCore/monticore */
/* This is a MontiCore stable grammar.
* Adaptations -- if any -- are conservative. */
/*
* This grammar defines a textual representation of
* use case diagrams (UCDs).
*
* This grammar defines the syntax for UCD artifacts, UCDs, use cases,
* actors, extend relations, includes relations, and associations between
* use cases and actors.
*
* This grammar extends the grammar
* * BasicSymbols for reusing the Diagram symbol kind.
* * MCBasicTypes for reusing import statements and package declarations.
* * CommonExpressions for reusing expressions that can be used as
* preconditions for use cases or conditions on extend relations.
* * MCCommonLiterals for reusing literals (i.e., BooleanLiteral).
*/
grammar UCD extends de.monticore.symbols.BasicSymbols,
de.monticore.types.MCBasicTypes,
de.monticore.expressions.CommonExpressions,
de.monticore.literals.MCCommonLiterals {
/**
* An artifact containing a use case diagram.
* @attribute MCPackageDeclaration The package of the use case diagram.
* @attribute MCImportStatement The import statements of the diagram.
* @attribute UseCaseDiagram The use case diagram in the artifact.
*/
UCDArtifact =
MCPackageDeclaration?
MCImportStatement*
UseCaseDiagram;
/**
* A use case diagram.
* Each use case diagram introduces a Diagram symbol.
* @attribute Name The name of the use case diagram.
* @attribute UCDElement Elements contained in the diagram.
*/
UseCaseDiagram implements Diagram =
"usecasediagram" Name "{"
UCDElement*
"}";
/**
* Elements contained in use case diagrams.
*/
interface UCDElement;
/**
* An use case.
* Each use case introduces an UCDUseCaseSymbol.
* @attribute abstract True iff the actor is abstract.
* @attribute Name The name of the use case.
* @attribute Expression Precondition that must be satisfied to execute
* the use case. Variables used in the expression are
* interpreted to be of type boolean and are implicitly
* introduced by their usage.
* @attribute sup Names of use cases extended by the use case.
* @attribute UCDExtend List of use cases to which there exists an
* extend. Extend may be guarded.
* @attribute incl List of use cases included by the use case.
*/
symbol UCDUseCase implements UCDElement =
["abstract"]? Name ("[" Expression "]")?
("specializes" sup:(Name@UCDUseCase || ",")+)?
("extend" (UCDExtend || ",")+ )?
("include" incl:(Name@UCDUseCase || ",")+ )?
";";
/**
* An extend or an include used in UCDUseCase.
* If the Expression is present, then the UCDConstrainedUC usage
* represents an extend. Otherwise, it represents an include.
* @attribute Name Target use case name of the extend or include.
* @attribute Expression Condition that must be satisfied to execute the
* extending use case when the extended use case is executed.
* Variables used in the expression are interpreted to be of
* type boolean and are implicitly introduced by their usage.
*/
UCDExtend =
Name@UCDUseCase ("[" Expression "]")?;
/**
* An actor.
* @attribute abstract True iff the actor is abstract.
* @attribute Name The name of the actor.
* @attribute sup Names of the actors extended by the actor.
* @attribute uc Names of use cases associated to the actor. The use
* cases are implicitly defined by their usage. Thus,
* UCDUseCaseSymbol may be defined (if they are not already
* defined via the usage of UCDUseCase).
*/
symbol UCDActor implements UCDElement =
["abstract"]? "@" Name
("specializes" sup:(Name@UCDActor || ",")+)?
("--" uc:(Name@UCDUseCase || ",")+)?
";";
}