-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuml.plantuml
145 lines (116 loc) · 2.41 KB
/
uml.plantuml
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
@startuml
class Lexer {
+ tokenize(): List<Token>
}
class Token {
+ type: String
+ value: Object
}
class Parser {
+ parse(): ProgramNode
}
enum Type {
PROGRAM
FUNCTION_DECLARATION
VARIABLE_DECLARATION
STATEMENT_LIST
RETURN
ASSIGNMENT
EXPRESSION
IDENTIFIER
INTEGER
STRING
BOOLEAN
OPERATOR
LEFT_PARENTHESIS
RIGHT_PARENTHESIS
LEFT_BRACE
RIGHT_BRACE
COMMA
}
class ProgramNode {
+ children: List<StatementNode>
}
abstract StatementNode {
}
class FunctionDeclarationNode extends StatementNode {
+ name: IdentifierNode
+ parameters: List<IdentifierNode>
+ body: BlockNode
}
class VariableDeclarationNode extends StatementNode {
+ name: IdentifierNode
+ initialValue: ExpressionNode
}
class ReturnNode extends StatementNode {
+ expression: ExpressionNode
}
class AssignmentNode extends StatementNode {
+ leftHandSide: ExpressionNode
+ operator: OperatorNode
+ rightHandSide: ExpressionNode
}
interface ExpressionNode {
}
class IdentifierNode implements ExpressionNode {
+ name: String
}
class IntegerLiteralNode implements ExpressionNode {
+ value: Int
}
class BooleanLiteralNode implements ExpressionNode {
+ value: Bool
}
class StringLiteralNode implements ExpressionNode {
+ value: String
}
class UnaryOperatorNode implements ExpressionNode {
+ operator: OperatorNode
+ operand: ExpressionNode
}
class BinaryOperatorNode implements ExpressionNode {
+ leftOperand: ExpressionNode
+ operator: OperatorNode
+ rightOperand: ExpressionNode
}
class CallExpressionNode implements ExpressionNode {
+ callee: ExpressionNode
+ arguments: List<ExpressionNode>
}
class MemberAccessNode implements ExpressionNode {
+ object: ExpressionNode
+ property: String
}
class ParenthesizedExpressionNode implements ExpressionNode {
+ expression: ExpressionNode
}
class BlockNode implements StatementNode {
+ statements: List<StatementNode>
}
class IfElseNode extends StatementNode {
+ condition: ExpressionNode
+ thenBranch: StatementNode
+ elseBranch: StatementNode
}
class WhileLoopNode extends StatementNode {
+ condition: ExpressionNode
+ body: StatementNode
}
class ForLoopNode extends StatementNode {
+ initialization: StatementNode
+ condition: ExpressionNode
+ increment: StatementNode
+ body: StatementNode
}
class BreakNode extends StatementNode {
}
class ContinueNode extends StatementNode {
}
class OperatorNode {
+ symbol: String
+ precedence: Int
}
SemanticAnalyzer --> Parser
CodeGenerator --> SemanticAnalyzer
Optimizer --> CodeGenerator
@enduml