-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathour_ast.pyi
executable file
·230 lines (128 loc) · 4.2 KB
/
our_ast.pyi
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
import typing
class_list = typing.List['ClassNode']
params_list = typing.List['ParamNode']
expr_list = typing.List['ExprNode']
attr_list = typing.List['AttrNode']
method_list = typing.List['MethodNode']
branch_list = typing.Tuple['BranchNode', ...]
assig_list = typing.List['AssigNode']
class ASTNode():
def __init__(self): ...
def node_name(self) -> str: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def to_tuple(self) -> typing.Tuple[str, str]: ...
class ExprNode(...):
def __init__(self): ...
class ProgramNode(...):
classes: class_list
def __init__(self, classes: class_list): ...
class MethodNode(...):
name: 'IdNode'
params: params_list
return_type: str
body: expr_list
def __init__(self, name: 'IdNode', params: params_list, return_type: str,
body: expr_list): ...
class ClassNode(...):
name: str
parent: str
attrs: attr_list
methods: method_list
def __init__(self, name: str, parent: str, attrs: attr_list,
methods: method_list): ...
class AttrNode(...):
name: 'IdNode'
type: str
value: typing.Optional['ExprNode']
def __init__(self, name: 'IdNode', type:str,
value: typing.Optional['ExprNode']): ...
class AssigNode(...):
name: 'IdNode'
value: 'ExprNode'
def __init__(self, name: str, value: 'ExprNode'): ...
class ParamNode(...):
name: 'IdNode'
type: str
def __init__(self, name: str, type: str): ...
class EqualNode(...):
rvalue: 'ExprNode'
lvalue: 'ExprNode'
def __init__(self, rvalue: 'ExprNode', lvalue: 'ExprNode'): ...
class LessOrEqualNode(...):
rvalue: 'ExprNode'
lvalue: 'ExprNode'
def __init__(self, lvalue: 'ExprNode', rvalue: 'ExprNode'): ...
class UnaryOpNode(...):
value: ExprNode
def __init__(self, value: ExprNode): ...
class BinaryOpNode(...):
def __init__(self, lvalue: 'ExprNode', rvalue: 'ExprNode'): ...
class DispatchNode(...):
name: 'IdNode'
args: expr_list
def __init__(self, name: 'IdNode', args: expr_list): ...
class DispatchSelfNode(...):
name: 'IdNode'
args: expr_list
def __init__(self, name: 'IdNode', args: expr_list): ...
class DispatchInheritsNode(...):
name: 'IdNode'
args: expr_list
type: str
expr: ExprNode
def __init__(self, name, args, type, expr): ...
class DispatchStaticNode(...):
name: 'IdNode'
args: expr_list
expr: ExprNode
def __init__(self, name, args, expr): ...
class IsVoidNode(...):
expr: ExprNode
def __init__(self, expr: ExprNode): ...
class NewNode(...):
type:str
def __init__(self, type: str): ...
class BlockNode(...):
body: expr_list
def __init__(self, body: expr_list): ...
class IfNode(...):
condition: ExprNode
true_body: ExprNode
false_body: ExprNode
def __init__(self, condition: ExprNode, true_body: ExprNode,
false_body: ExprNode): ...
class CaseNode(...):
condition: ExprNode
branches: branch_list
def __init__(self, condition: ExprNode, branches: branch_list): ...
class NegationNode(...):
value: ExprNode
def __init__(self, value: ExprNode): ...
class ParNode(...):
expr: ExprNode
def __init__(self, expr: ExprNode): ...
class IdNode(...):
def __init__(self, name: str): ...
class BranchNode(...):
name: 'IdNode'
type: str
expr: ExprNode
def __init__(self, name: 'IdNode', type: str, expr: ExprNode): ...
class WhileNode(...):
condition: ExprNode
body: ExprNode
def __init__(self, condition: ExprNode, body: ExprNode): ...
class SelfNode(...):
def __init__(self): ...
class SelfTypeNode(...):
def __init__(self): ...
class LetNode(...):
body: ExprNode
initializers: attr_list
def __init__(self, body: ExprNode, initializers: attr_list): ...
class OperationNode(...):
def __init__(self): ...
class ConstantNode(...):
value: typing.Any
def __init__(self, value): ...