owl-basic 0.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- owl_basic/__init__.py +3 -0
- owl_basic/algorithms.py +29 -0
- owl_basic/ast_utils.py +204 -0
- owl_basic/basic_visitor.py +55 -0
- owl_basic/cfg_vertex.py +65 -0
- owl_basic/codegen/__init__.py +0 -0
- owl_basic/codegen/clr/__init__.py +0 -0
- owl_basic/codegen/clr/cil_visitor.py +1296 -0
- owl_basic/codegen/clr/cts.py +56 -0
- owl_basic/codegen/clr/emitters.py +94 -0
- owl_basic/codegen/clr/generate.py +539 -0
- owl_basic/correlation_visitor.py +119 -0
- owl_basic/data_visitor.py +62 -0
- owl_basic/decoder.py +339 -0
- owl_basic/errors.py +22 -0
- owl_basic/flow/__init__.py +17 -0
- owl_basic/flow/basic_block.py +34 -0
- owl_basic/flow/basic_block_identifier.py +66 -0
- owl_basic/flow/basic_block_orderer.py +29 -0
- owl_basic/flow/connectors.py +19 -0
- owl_basic/flow/convert_sub_visitor.py +28 -0
- owl_basic/flow/entry_point_locator.py +55 -0
- owl_basic/flow/entry_point_visitor.py +48 -0
- owl_basic/flow/flow_analysis.py +56 -0
- owl_basic/flow/flow_graph_creator.py +14 -0
- owl_basic/flow/flowgraph_visitor.py +178 -0
- owl_basic/flow/longjump_converter.py +20 -0
- owl_basic/flow/longjump_visitor.py +53 -0
- owl_basic/flow/subroutine_converter.py +38 -0
- owl_basic/flow/traversal.py +110 -0
- owl_basic/gml_visitor.py +151 -0
- owl_basic/line_mapper.py +43 -0
- owl_basic/line_number_visitor.py +65 -0
- owl_basic/main.py +381 -0
- owl_basic/node.py +21 -0
- owl_basic/options.py +22 -0
- owl_basic/owltyping/__init__.py +1 -0
- owl_basic/owltyping/function_type_inferer.py +50 -0
- owl_basic/owltyping/hindley_milner.py +524 -0
- owl_basic/owltyping/set_function_type_visitor.py +25 -0
- owl_basic/owltyping/type_system.py +220 -0
- owl_basic/owltyping/typecheck.py +60 -0
- owl_basic/owltyping/typecheck_visitor.py +471 -0
- owl_basic/parent_visitor.py +37 -0
- owl_basic/process.py +36 -0
- owl_basic/separation_visitor.py +98 -0
- owl_basic/sigil.py +30 -0
- owl_basic/simplify_visitor.py +204 -0
- owl_basic/singleton.py +127 -0
- owl_basic/source_debugging.py +124 -0
- owl_basic/symbol_table_visitor.py +220 -0
- owl_basic/symbol_tables.py +195 -0
- owl_basic/syntax/__init__.py +0 -0
- owl_basic/syntax/ast.py +1081 -0
- owl_basic/syntax/ast_meta.py +228 -0
- owl_basic/syntax/grammar.py +1972 -0
- owl_basic/syntax/lexer.py +943 -0
- owl_basic/syntax/parser.py +77 -0
- owl_basic/utility.py +26 -0
- owl_basic/visitor.py +43 -0
- owl_basic/xml_blocks.py +137 -0
- owl_basic/xml_visitor.py +101 -0
- owl_basic-0.6.0.dist-info/METADATA +37 -0
- owl_basic-0.6.0.dist-info/RECORD +69 -0
- owl_basic-0.6.0.dist-info/WHEEL +5 -0
- owl_basic-0.6.0.dist-info/entry_points.txt +2 -0
- owl_basic-0.6.0.dist-info/licenses/LICENSE +21 -0
- owl_basic-0.6.0.dist-info/licenses/THIRD-PARTY-NOTICES.md +57 -0
- owl_basic-0.6.0.dist-info/top_level.txt +1 -0
owl_basic/syntax/ast.py
ADDED
|
@@ -0,0 +1,1081 @@
|
|
|
1
|
+
# Abstract Syntax Tree for BBC# Basic
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
import re
|
|
5
|
+
|
|
6
|
+
from .ast_meta import AstNode, Node
|
|
7
|
+
from owl_basic.options import (TypeOption, IntegerOption, StringOption, BoolOption,
|
|
8
|
+
FloatOption)
|
|
9
|
+
from owl_basic.cfg_vertex import CfgVertex
|
|
10
|
+
from owl_basic.owltyping.type_system import (VoidOwlType, IntegerOwlType, ChannelOwlType,
|
|
11
|
+
ScalarOwlType, NumericOwlType, StringOwlType,
|
|
12
|
+
FloatOwlType, AddressOwlType, ByteOwlType,
|
|
13
|
+
PendingOwlType, ArrayOwlType, ObjectOwlType)
|
|
14
|
+
|
|
15
|
+
class AstStatement(AstNode, CfgVertex):
|
|
16
|
+
formal_type = TypeOption(VoidOwlType())
|
|
17
|
+
actual_type = formal_type
|
|
18
|
+
start_line = IntegerOption() # One-based line number for source level debugging
|
|
19
|
+
end_line = IntegerOption() # One-based line number for source level debugging
|
|
20
|
+
start_pos = IntegerOption() # Zero-based file offset
|
|
21
|
+
end_pos = IntegerOption() # Zero-based file offset
|
|
22
|
+
start_column = IntegerOption() # One based column number for source level debugging
|
|
23
|
+
end_column = IntegerOption() # One based column number for source level debugging
|
|
24
|
+
|
|
25
|
+
class Program(AstNode):
|
|
26
|
+
#formal_type = TypeOption(None)
|
|
27
|
+
statements = Node()
|
|
28
|
+
|
|
29
|
+
class StatementList(AstNode):
|
|
30
|
+
formal_type = TypeOption(None)
|
|
31
|
+
statements = [Node()]
|
|
32
|
+
|
|
33
|
+
def prepend(self, statement):
|
|
34
|
+
self.statements.insert(0, statement)
|
|
35
|
+
|
|
36
|
+
def append(self, statement):
|
|
37
|
+
self.statements.append(statement)
|
|
38
|
+
|
|
39
|
+
def extend(self, statement_list):
|
|
40
|
+
self.statements.extend(statement_list.statements)
|
|
41
|
+
|
|
42
|
+
class MarkerStatement(AstStatement):
|
|
43
|
+
following_statement = Node()
|
|
44
|
+
|
|
45
|
+
class Beats(AstStatement):
|
|
46
|
+
counter = Node(formalType=IntegerOwlType())
|
|
47
|
+
|
|
48
|
+
class Channel(AstStatement):
|
|
49
|
+
channel = Node(formalType=IntegerOwlType())
|
|
50
|
+
|
|
51
|
+
class Dim(AstStatement):
|
|
52
|
+
items = Node()
|
|
53
|
+
|
|
54
|
+
class DimList(AstNode):
|
|
55
|
+
formal_type = TypeOption(None)
|
|
56
|
+
items = [Node()]
|
|
57
|
+
|
|
58
|
+
def append(self, node):
|
|
59
|
+
self.items.append(node)
|
|
60
|
+
|
|
61
|
+
class AllocateArray(AstStatement):
|
|
62
|
+
identifier = StringOption()
|
|
63
|
+
dimensions = Node()
|
|
64
|
+
|
|
65
|
+
class AllocateBlock(AstStatement):
|
|
66
|
+
identifier = Node()
|
|
67
|
+
size = Node(formalType=IntegerOwlType())
|
|
68
|
+
|
|
69
|
+
class Assignment(AstStatement):
|
|
70
|
+
l_value = Node()
|
|
71
|
+
r_value = Node()
|
|
72
|
+
|
|
73
|
+
class ScalarAssignment(Assignment):
|
|
74
|
+
pass
|
|
75
|
+
|
|
76
|
+
class ArrayAssignment(Assignment):
|
|
77
|
+
pass
|
|
78
|
+
|
|
79
|
+
class Increment(AstStatement):
|
|
80
|
+
l_value = Node()
|
|
81
|
+
r_value = Node()
|
|
82
|
+
|
|
83
|
+
class Decrement(AstStatement):
|
|
84
|
+
l_value = Node()
|
|
85
|
+
r_value = Node()
|
|
86
|
+
|
|
87
|
+
class Bput(AstStatement):
|
|
88
|
+
channel = Node(formalType=ChannelOwlType())
|
|
89
|
+
data = Node(formalType=IntegerOwlType())
|
|
90
|
+
# TODO: Whether newline is True or False depends on
|
|
91
|
+
# the type of data. If data is a number,
|
|
92
|
+
# we default to False, if data is a string we
|
|
93
|
+
# default to True.
|
|
94
|
+
newline = BoolOption(False)
|
|
95
|
+
|
|
96
|
+
class Call(AstStatement):
|
|
97
|
+
address = Node() # TODO: AddressOwlType()?
|
|
98
|
+
parameters = Node() # TODO: Needs handling in grammar
|
|
99
|
+
|
|
100
|
+
class Circle(AstStatement):
|
|
101
|
+
x_coord = Node(formalType=IntegerOwlType())
|
|
102
|
+
y_coord = Node(formalType=IntegerOwlType())
|
|
103
|
+
radius = Node(formalType=IntegerOwlType())
|
|
104
|
+
fill = BoolOption(False)
|
|
105
|
+
|
|
106
|
+
class Cls(AstStatement):
|
|
107
|
+
pass
|
|
108
|
+
|
|
109
|
+
class Clg(AstStatement):
|
|
110
|
+
pass
|
|
111
|
+
|
|
112
|
+
class Colour(AstStatement):
|
|
113
|
+
colour = Node(formalType=IntegerOwlType())
|
|
114
|
+
tint = Node(formalType=IntegerOwlType())
|
|
115
|
+
|
|
116
|
+
class Palette(AstStatement):
|
|
117
|
+
physical_colour = Node(formalType=IntegerOwlType())
|
|
118
|
+
logical_colour = Node(formalType=IntegerOwlType())
|
|
119
|
+
red = Node(formalType=IntegerOwlType())
|
|
120
|
+
green = Node(formalType=IntegerOwlType())
|
|
121
|
+
blue = Node(formalType=IntegerOwlType())
|
|
122
|
+
|
|
123
|
+
class Case(AstStatement):
|
|
124
|
+
condition = Node(ScalarOwlType())
|
|
125
|
+
when_clauses = Node()
|
|
126
|
+
|
|
127
|
+
class WhenClauseList(AstNode):
|
|
128
|
+
clauses = [Node()]
|
|
129
|
+
|
|
130
|
+
def append(self, when_clause):
|
|
131
|
+
self.clauses.append(when_clause)
|
|
132
|
+
|
|
133
|
+
class WhenClause(AstNode):
|
|
134
|
+
matches = Node()
|
|
135
|
+
statements = Node()
|
|
136
|
+
|
|
137
|
+
class OtherwiseClause(AstNode):
|
|
138
|
+
statements = Node()
|
|
139
|
+
|
|
140
|
+
class Close(AstStatement):
|
|
141
|
+
channel = Node(formalType=ChannelOwlType())
|
|
142
|
+
|
|
143
|
+
class Data(AstStatement):
|
|
144
|
+
data = StringOption()
|
|
145
|
+
|
|
146
|
+
class Rem(AstStatement):
|
|
147
|
+
data = StringOption()
|
|
148
|
+
|
|
149
|
+
class DefinitionStatement(MarkerStatement):
|
|
150
|
+
name = StringOption()
|
|
151
|
+
formal_parameters = Node()
|
|
152
|
+
|
|
153
|
+
class DefineFunction(DefinitionStatement):
|
|
154
|
+
"DEF FN"
|
|
155
|
+
return_type = TypeOption(None) # Used to store the return type
|
|
156
|
+
|
|
157
|
+
class ReturnFromFunction(AstStatement):
|
|
158
|
+
return_value = Node(formalType=ScalarOwlType()) # TODO: Can functions return arrays
|
|
159
|
+
|
|
160
|
+
class DefineProcedure(DefinitionStatement):
|
|
161
|
+
"DEF PROC"
|
|
162
|
+
pass
|
|
163
|
+
|
|
164
|
+
class ReturnFromProcedure(AstStatement):
|
|
165
|
+
pass
|
|
166
|
+
|
|
167
|
+
class ForToStep(AstStatement):
|
|
168
|
+
identifier = Node()
|
|
169
|
+
first = Node(formalType=NumericOwlType())
|
|
170
|
+
last = Node(formalType=NumericOwlType())
|
|
171
|
+
step = Node(formalType=NumericOwlType())
|
|
172
|
+
|
|
173
|
+
class Next(AstStatement):
|
|
174
|
+
identifiers = Node()
|
|
175
|
+
|
|
176
|
+
class Draw(AstStatement):
|
|
177
|
+
"DRAW"
|
|
178
|
+
x_coord = Node(formalType=IntegerOwlType(), description="The x co-ordinate")
|
|
179
|
+
y_coord = Node(formalType=IntegerOwlType(), description="The y co-ordinate")
|
|
180
|
+
relative = BoolOption(False)
|
|
181
|
+
|
|
182
|
+
class Ellipse(AstStatement):
|
|
183
|
+
x_coord = Node(formalType=IntegerOwlType())
|
|
184
|
+
y_coord = Node(formalType=IntegerOwlType())
|
|
185
|
+
semi_major = Node(formalType=IntegerOwlType())
|
|
186
|
+
semi_minor = Node(formalType=IntegerOwlType())
|
|
187
|
+
radians = Node(formalType=IntegerOwlType())
|
|
188
|
+
fill = BoolOption(False)
|
|
189
|
+
|
|
190
|
+
class GenerateError(AstStatement):
|
|
191
|
+
number = Node(formalType=IntegerOwlType())
|
|
192
|
+
description = Node(formalType=StringOwlType())
|
|
193
|
+
|
|
194
|
+
class ReturnError(AstStatement):
|
|
195
|
+
number = Node(formalType=IntegerOwlType())
|
|
196
|
+
description = Node(formalType=StringOwlType())
|
|
197
|
+
|
|
198
|
+
class End(AstStatement):
|
|
199
|
+
pass
|
|
200
|
+
|
|
201
|
+
class Envelope(AstStatement):
|
|
202
|
+
n = Node(formalType=IntegerOwlType())
|
|
203
|
+
t = Node(formalType=IntegerOwlType())
|
|
204
|
+
pitch1 = Node(formalType=IntegerOwlType())
|
|
205
|
+
pitch2 = Node(formalType=IntegerOwlType())
|
|
206
|
+
pitch3 = Node(formalType=IntegerOwlType())
|
|
207
|
+
num_steps_1 = Node(formalType=IntegerOwlType())
|
|
208
|
+
num_steps_2 = Node(formalType=IntegerOwlType())
|
|
209
|
+
num_steps_3 = Node(formalType=IntegerOwlType())
|
|
210
|
+
amplitude_attack = Node(formalType=IntegerOwlType())
|
|
211
|
+
amplitude_decay = Node(formalType=IntegerOwlType())
|
|
212
|
+
amplitude_sustain = Node(formalType=IntegerOwlType())
|
|
213
|
+
amplitude_release = Node(formalType=IntegerOwlType())
|
|
214
|
+
target_attack = Node(formalType=IntegerOwlType())
|
|
215
|
+
target_decay = Node(formalType=IntegerOwlType())
|
|
216
|
+
|
|
217
|
+
class Fill(AstStatement):
|
|
218
|
+
x_coord = Node(formalType=IntegerOwlType())
|
|
219
|
+
y_coord = Node(formalType=IntegerOwlType())
|
|
220
|
+
relative = BoolOption(False)
|
|
221
|
+
|
|
222
|
+
class Gcol(AstStatement):
|
|
223
|
+
mode = Node(formalType=IntegerOwlType())
|
|
224
|
+
logical_colour = Node(formalType=IntegerOwlType())
|
|
225
|
+
tint = Node(formalType=IntegerOwlType())
|
|
226
|
+
|
|
227
|
+
class Goto(AstStatement):
|
|
228
|
+
target_logical_line = Node(formalType=IntegerOwlType())
|
|
229
|
+
|
|
230
|
+
class OnGoto(AstStatement):
|
|
231
|
+
switch = Node(formalType=IntegerOwlType())
|
|
232
|
+
target_logical_lines = Node()
|
|
233
|
+
out_of_range_clause = Node()
|
|
234
|
+
|
|
235
|
+
class Gosub(AstStatement):
|
|
236
|
+
target_logical_line = Node(formalType=IntegerOwlType())
|
|
237
|
+
|
|
238
|
+
class Return(AstStatement):
|
|
239
|
+
pass
|
|
240
|
+
|
|
241
|
+
class Input(AstStatement):
|
|
242
|
+
# TODO: Needs updating for all INPUT syntax including INPUT LINE
|
|
243
|
+
input_list = Node()
|
|
244
|
+
input_line = BoolOption(False)
|
|
245
|
+
|
|
246
|
+
class InputFile(AstStatement):
|
|
247
|
+
channel = Node(formalType=ChannelOwlType())
|
|
248
|
+
items = Node()
|
|
249
|
+
|
|
250
|
+
class InputList(AstNode):
|
|
251
|
+
items = [Node()]
|
|
252
|
+
|
|
253
|
+
def append(self, item):
|
|
254
|
+
self.items.append(item)
|
|
255
|
+
|
|
256
|
+
class InputItem(AstNode):
|
|
257
|
+
item = Node()
|
|
258
|
+
|
|
259
|
+
class InputManipulator(AstNode):
|
|
260
|
+
manipulator = StringOption()
|
|
261
|
+
|
|
262
|
+
class Install(AstStatement):
|
|
263
|
+
filename = Node(formalType=StringOwlType())
|
|
264
|
+
|
|
265
|
+
class If(AstStatement):
|
|
266
|
+
condition = Node(formalType=IntegerOwlType())
|
|
267
|
+
true_clause = Node()
|
|
268
|
+
false_clause = Node()
|
|
269
|
+
|
|
270
|
+
class LoadLibrary(AstStatement):
|
|
271
|
+
filename = Node(formalType=StringOwlType())
|
|
272
|
+
|
|
273
|
+
class Local(AstStatement):
|
|
274
|
+
variables = Node()
|
|
275
|
+
|
|
276
|
+
class Mandel(AstStatement):
|
|
277
|
+
"MANDEL"
|
|
278
|
+
i_coord = Node(formalType=FloatOwlType(), description="The i coordinate")
|
|
279
|
+
j_coord = Node(formalType=FloatOwlType(), description="The j coordinate")
|
|
280
|
+
|
|
281
|
+
class Move(AstStatement):
|
|
282
|
+
"MOVE"
|
|
283
|
+
x_coord = Node(formalType=IntegerOwlType(), description="The x coordinate")
|
|
284
|
+
y_coord = Node(formalType=IntegerOwlType(), description="The y coordinate")
|
|
285
|
+
relative = BoolOption(False)
|
|
286
|
+
|
|
287
|
+
class Mode(AstStatement):
|
|
288
|
+
"MODE"
|
|
289
|
+
number = Node(formalType=IntegerOwlType())
|
|
290
|
+
width = Node(formalType=IntegerOwlType())
|
|
291
|
+
height = Node(formalType=IntegerOwlType())
|
|
292
|
+
bits_per_pixel = Node(formalType=IntegerOwlType())
|
|
293
|
+
frame_rate = Node(formalType=IntegerOwlType())
|
|
294
|
+
|
|
295
|
+
class Mouse(AstStatement):
|
|
296
|
+
"MOUSE"
|
|
297
|
+
x_coord = Node(formalType=IntegerOwlType())
|
|
298
|
+
y_coord = Node(formalType=IntegerOwlType())
|
|
299
|
+
buttons = Node(formalType=IntegerOwlType())
|
|
300
|
+
time = Node(formalType=IntegerOwlType())
|
|
301
|
+
|
|
302
|
+
class MouseStep(AstStatement):
|
|
303
|
+
"MOUSE STEP"
|
|
304
|
+
x_coeff = Node(formalType=NumericOwlType())
|
|
305
|
+
y_coeff = Node(formalType=NumericOwlType())
|
|
306
|
+
|
|
307
|
+
class MouseColour(AstStatement):
|
|
308
|
+
logical_colour = Node(formalType=IntegerOwlType())
|
|
309
|
+
red = Node(formalType=IntegerOwlType())
|
|
310
|
+
green = Node(formalType=IntegerOwlType())
|
|
311
|
+
blue = Node(formalType=IntegerOwlType())
|
|
312
|
+
|
|
313
|
+
class MousePosition(AstStatement):
|
|
314
|
+
"MOUSE TO"
|
|
315
|
+
x_coord = Node(formalType=IntegerOwlType())
|
|
316
|
+
y_coord = Node(formalType=IntegerOwlType())
|
|
317
|
+
move_mouse = BoolOption(True)
|
|
318
|
+
move_pointer = BoolOption(True)
|
|
319
|
+
|
|
320
|
+
class MousePointer(AstStatement):
|
|
321
|
+
shape = Node(formalType=IntegerOwlType())
|
|
322
|
+
|
|
323
|
+
class MouseRectangleOn(AstStatement):
|
|
324
|
+
"MOUSE RECTANGLE"
|
|
325
|
+
left = Node(formalType=IntegerOwlType())
|
|
326
|
+
bottom = Node(formalType=IntegerOwlType())
|
|
327
|
+
right = Node(formalType=IntegerOwlType())
|
|
328
|
+
top = Node(formalType=IntegerOwlType())
|
|
329
|
+
|
|
330
|
+
class MouseRectangleOff(AstStatement):
|
|
331
|
+
pass
|
|
332
|
+
|
|
333
|
+
class On(AstStatement):
|
|
334
|
+
"ON"
|
|
335
|
+
pass
|
|
336
|
+
|
|
337
|
+
class Off(AstStatement):
|
|
338
|
+
"OFF"
|
|
339
|
+
pass
|
|
340
|
+
|
|
341
|
+
class Origin(AstStatement):
|
|
342
|
+
"ORIGIN"
|
|
343
|
+
x_coord = Node(formalType=IntegerOwlType())
|
|
344
|
+
y_coord = Node(formalType=IntegerOwlType())
|
|
345
|
+
|
|
346
|
+
class Oscli(AstStatement):
|
|
347
|
+
"OSCLI"
|
|
348
|
+
command = Node(formalType=StringOwlType())
|
|
349
|
+
|
|
350
|
+
class Plot(AstStatement):
|
|
351
|
+
"PLOT"
|
|
352
|
+
mode = Node(formalType=IntegerOwlType())
|
|
353
|
+
x_coord = Node(formalType=IntegerOwlType())
|
|
354
|
+
y_coord = Node(formalType=IntegerOwlType())
|
|
355
|
+
relative = BoolOption(False)
|
|
356
|
+
|
|
357
|
+
class Point(AstStatement):
|
|
358
|
+
x_coord = Node(formalType=IntegerOwlType())
|
|
359
|
+
y_coord = Node(formalType=IntegerOwlType())
|
|
360
|
+
relative = BoolOption(False)
|
|
361
|
+
|
|
362
|
+
class Print(AstStatement):
|
|
363
|
+
print_list = Node()
|
|
364
|
+
|
|
365
|
+
class PrintList(AstNode):
|
|
366
|
+
items = [Node()]
|
|
367
|
+
|
|
368
|
+
def append(self, item):
|
|
369
|
+
self.items.append(item)
|
|
370
|
+
|
|
371
|
+
class PrintItem(AstNode):
|
|
372
|
+
item = Node()
|
|
373
|
+
|
|
374
|
+
class PrintManipulator(AstNode):
|
|
375
|
+
pass
|
|
376
|
+
|
|
377
|
+
class FormatManipulator(PrintManipulator):
|
|
378
|
+
manipulator = StringOption()
|
|
379
|
+
|
|
380
|
+
class PrintFile(AstStatement):
|
|
381
|
+
channel = Node(formalType=ChannelOwlType())
|
|
382
|
+
items = Node()
|
|
383
|
+
|
|
384
|
+
class CallProcedure(AstStatement):
|
|
385
|
+
"PROC"
|
|
386
|
+
name = StringOption()
|
|
387
|
+
actual_parameters = Node()
|
|
388
|
+
|
|
389
|
+
class Private(AstStatement):
|
|
390
|
+
variables = Node()
|
|
391
|
+
|
|
392
|
+
class Quit(AstStatement):
|
|
393
|
+
"QUIT"
|
|
394
|
+
code = Node(formalType=IntegerOwlType())
|
|
395
|
+
|
|
396
|
+
class Rectangle(AstStatement):
|
|
397
|
+
x_coord = Node(formalType=IntegerOwlType())
|
|
398
|
+
y_coord = Node(formalType=IntegerOwlType())
|
|
399
|
+
width = Node(formalType=IntegerOwlType())
|
|
400
|
+
height = Node(formalType=IntegerOwlType()) # None ==> square
|
|
401
|
+
fill = BoolOption(False)
|
|
402
|
+
|
|
403
|
+
class RectangleBlit(AstStatement):
|
|
404
|
+
x_coord_source = Node(formalType=IntegerOwlType())
|
|
405
|
+
y_coord_source = Node(formalType=IntegerOwlType())
|
|
406
|
+
width = Node(formalType=IntegerOwlType())
|
|
407
|
+
height = Node(formalType=IntegerOwlType()) # None ==> square
|
|
408
|
+
x_coord_target = Node(formalType=IntegerOwlType())
|
|
409
|
+
y_coord_target = Node(formalType=IntegerOwlType())
|
|
410
|
+
|
|
411
|
+
class CopyRectangle(RectangleBlit):
|
|
412
|
+
pass
|
|
413
|
+
|
|
414
|
+
class MoveRectangle(RectangleBlit):
|
|
415
|
+
pass
|
|
416
|
+
|
|
417
|
+
class SwapRectangle(RectangleBlit):
|
|
418
|
+
pass
|
|
419
|
+
|
|
420
|
+
class Read(AstStatement):
|
|
421
|
+
"READ"
|
|
422
|
+
writables = Node()
|
|
423
|
+
|
|
424
|
+
class Report(AstStatement):
|
|
425
|
+
"REPORT"
|
|
426
|
+
pass
|
|
427
|
+
|
|
428
|
+
class Repeat(MarkerStatement):
|
|
429
|
+
"REPEAT"
|
|
430
|
+
pass
|
|
431
|
+
|
|
432
|
+
class Restore(AstStatement):
|
|
433
|
+
"RESTORE"
|
|
434
|
+
target_logical_line = Node(formalType=IntegerOwlType())
|
|
435
|
+
|
|
436
|
+
class Run(AstStatement):
|
|
437
|
+
"RUN"
|
|
438
|
+
pass
|
|
439
|
+
|
|
440
|
+
class Sound(AstStatement):
|
|
441
|
+
"SOUND"
|
|
442
|
+
channel = Node(formalType=IntegerOwlType())
|
|
443
|
+
amplitude = Node(formalType=IntegerOwlType())
|
|
444
|
+
pitch = Node(formalType=IntegerOwlType())
|
|
445
|
+
duration = Node(formalType=IntegerOwlType())
|
|
446
|
+
|
|
447
|
+
class Mute(AstStatement):
|
|
448
|
+
mute = BoolOption(False)
|
|
449
|
+
|
|
450
|
+
class Swap(AstStatement):
|
|
451
|
+
identifier1 = StringOption()
|
|
452
|
+
identifier2 = StringOption()
|
|
453
|
+
|
|
454
|
+
class Stop(AstStatement):
|
|
455
|
+
pass
|
|
456
|
+
|
|
457
|
+
class Stereo(AstStatement):
|
|
458
|
+
channel = Node(formalType=IntegerOwlType())
|
|
459
|
+
position = Node(formalType=IntegerOwlType())
|
|
460
|
+
|
|
461
|
+
class Sys(AstStatement):
|
|
462
|
+
routine = Node()
|
|
463
|
+
actual_parameters = Node()
|
|
464
|
+
return_values = Node()
|
|
465
|
+
flags = Node()
|
|
466
|
+
|
|
467
|
+
class Tab(PrintManipulator):
|
|
468
|
+
pass
|
|
469
|
+
|
|
470
|
+
class TabH(Tab):
|
|
471
|
+
x_coord = Node(formalType=IntegerOwlType())
|
|
472
|
+
|
|
473
|
+
class TabXY(Tab):
|
|
474
|
+
x_coord = Node(formalType=IntegerOwlType())
|
|
475
|
+
y_coord = Node(formalType=IntegerOwlType())
|
|
476
|
+
|
|
477
|
+
class Tempo(AstStatement):
|
|
478
|
+
rate = Node(formalType=IntegerOwlType())
|
|
479
|
+
|
|
480
|
+
class Tint(AstStatement):
|
|
481
|
+
option = Node(formalType=IntegerOwlType())
|
|
482
|
+
tint = Node(formalType=IntegerOwlType())
|
|
483
|
+
|
|
484
|
+
class Spc(PrintManipulator):
|
|
485
|
+
spaces = Node(formalType=IntegerOwlType())
|
|
486
|
+
|
|
487
|
+
class VariableList(AstNode):
|
|
488
|
+
variables = [Node()]
|
|
489
|
+
|
|
490
|
+
def append(self, variable):
|
|
491
|
+
self.variables.append(variable)
|
|
492
|
+
|
|
493
|
+
class Value(AstNode):
|
|
494
|
+
is_l_value = BoolOption(False)
|
|
495
|
+
|
|
496
|
+
class Variable(Value):
|
|
497
|
+
identifier = StringOption()
|
|
498
|
+
|
|
499
|
+
class WritableList(AstNode):
|
|
500
|
+
writables = [Node()]
|
|
501
|
+
|
|
502
|
+
def append(self, writable):
|
|
503
|
+
self.writables.append(writable)
|
|
504
|
+
|
|
505
|
+
class Array(AstNode):
|
|
506
|
+
identifier = StringOption()
|
|
507
|
+
|
|
508
|
+
class Indexer(Value):
|
|
509
|
+
identifier = StringOption()
|
|
510
|
+
indices = Node()
|
|
511
|
+
|
|
512
|
+
class Until(AstStatement):
|
|
513
|
+
condition = Node()
|
|
514
|
+
|
|
515
|
+
class Voices(AstStatement):
|
|
516
|
+
number_of_voices = Node()
|
|
517
|
+
|
|
518
|
+
class Vdu(AstStatement):
|
|
519
|
+
bytes = Node()
|
|
520
|
+
|
|
521
|
+
class VduList(AstNode):
|
|
522
|
+
items = [Node()]
|
|
523
|
+
|
|
524
|
+
def append(self, item):
|
|
525
|
+
self.items.append(item)
|
|
526
|
+
|
|
527
|
+
class VduItem(AstNode):
|
|
528
|
+
item = Node(formalType=IntegerOwlType())
|
|
529
|
+
length = IntegerOption(default=1)
|
|
530
|
+
|
|
531
|
+
class While(AstStatement):
|
|
532
|
+
condition = Node(formalType=IntegerOwlType())
|
|
533
|
+
|
|
534
|
+
class Endwhile(AstStatement):
|
|
535
|
+
pass
|
|
536
|
+
|
|
537
|
+
class Width(AstStatement):
|
|
538
|
+
line_width = Node(formalType=IntegerOwlType())
|
|
539
|
+
|
|
540
|
+
class Wait(AstStatement):
|
|
541
|
+
centiseconds = Node(formalType=IntegerOwlType())
|
|
542
|
+
|
|
543
|
+
class ExpressionList(AstNode):
|
|
544
|
+
expressions = [Node()]
|
|
545
|
+
|
|
546
|
+
def append(self, expr):
|
|
547
|
+
self.expressions.append(expr)
|
|
548
|
+
|
|
549
|
+
class ActualArgList(AstNode):
|
|
550
|
+
arguments = [Node()]
|
|
551
|
+
|
|
552
|
+
def append(self, arg):
|
|
553
|
+
self.arguments.append(arg)
|
|
554
|
+
|
|
555
|
+
class FormalArgList(AstNode):
|
|
556
|
+
arguments = [Node()]
|
|
557
|
+
|
|
558
|
+
def append(self, arg):
|
|
559
|
+
self.arguments.append(arg)
|
|
560
|
+
|
|
561
|
+
class FormalArgument(AstNode):
|
|
562
|
+
argument = Node()
|
|
563
|
+
|
|
564
|
+
class FormalReferenceArgument(AstNode):
|
|
565
|
+
argument = Node()
|
|
566
|
+
|
|
567
|
+
class UnaryNumericOperator(AstNode):
|
|
568
|
+
factor = Node(formalType=NumericOwlType())
|
|
569
|
+
|
|
570
|
+
class UnaryPlus(UnaryNumericOperator):
|
|
571
|
+
pass
|
|
572
|
+
|
|
573
|
+
class UnaryMinus(UnaryNumericOperator):
|
|
574
|
+
pass
|
|
575
|
+
|
|
576
|
+
class UnaryIndirection(Value):
|
|
577
|
+
expression = Node(formalType=AddressOwlType())
|
|
578
|
+
|
|
579
|
+
class UnaryByteIndirection(UnaryIndirection):
|
|
580
|
+
formal_type = TypeOption(ByteOwlType())
|
|
581
|
+
actual_type = formal_type
|
|
582
|
+
|
|
583
|
+
class UnaryIntegerIndirection(UnaryIndirection):
|
|
584
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
585
|
+
actual_type = formal_type
|
|
586
|
+
|
|
587
|
+
class UnaryStringIndirection(UnaryIndirection):
|
|
588
|
+
formal_type = TypeOption(StringOwlType())
|
|
589
|
+
actual_type = formal_type
|
|
590
|
+
|
|
591
|
+
class UnaryFloatIndirection(UnaryIndirection):
|
|
592
|
+
formal_type = TypeOption(FloatOwlType())
|
|
593
|
+
actual_type = formal_type
|
|
594
|
+
|
|
595
|
+
class DyadicIndirection(Value):
|
|
596
|
+
base = Node(formalType=AddressOwlType())
|
|
597
|
+
offset = Node(formalType=IntegerOwlType())
|
|
598
|
+
|
|
599
|
+
class DyadicByteIndirection(DyadicIndirection):
|
|
600
|
+
formal_type = TypeOption(ByteOwlType())
|
|
601
|
+
actual_type = formal_type
|
|
602
|
+
|
|
603
|
+
class DyadicIntegerIndirection(DyadicIndirection):
|
|
604
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
605
|
+
actual_type = formal_type
|
|
606
|
+
|
|
607
|
+
class Not(AstNode):
|
|
608
|
+
"NOT"
|
|
609
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
610
|
+
actual_type = formal_type
|
|
611
|
+
factor = Node(formalType=IntegerOwlType())
|
|
612
|
+
|
|
613
|
+
class BinaryOperator(AstNode):
|
|
614
|
+
lhs = Node()
|
|
615
|
+
rhs = Node()
|
|
616
|
+
|
|
617
|
+
class BinaryNumericOperator(BinaryOperator):
|
|
618
|
+
lhs = Node(formalType=NumericOwlType())
|
|
619
|
+
rhs = Node(formalType=NumericOwlType())
|
|
620
|
+
|
|
621
|
+
class Plus(BinaryNumericOperator):
|
|
622
|
+
"+"
|
|
623
|
+
pass
|
|
624
|
+
|
|
625
|
+
class Minus(BinaryNumericOperator):
|
|
626
|
+
"-"
|
|
627
|
+
pass
|
|
628
|
+
|
|
629
|
+
class Multiply(BinaryNumericOperator):
|
|
630
|
+
"*"
|
|
631
|
+
pass
|
|
632
|
+
|
|
633
|
+
class Divide(BinaryNumericOperator):
|
|
634
|
+
"/"
|
|
635
|
+
pass
|
|
636
|
+
|
|
637
|
+
class Power(BinaryNumericOperator):
|
|
638
|
+
"^"
|
|
639
|
+
pass
|
|
640
|
+
|
|
641
|
+
class MatrixMultiply(BinaryOperator):
|
|
642
|
+
pass
|
|
643
|
+
|
|
644
|
+
class BinaryIntegerOperator(BinaryOperator):
|
|
645
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
646
|
+
actual_type = formal_type
|
|
647
|
+
lhs = Node(formalType=IntegerOwlType())
|
|
648
|
+
rhs = Node(formalType=IntegerOwlType())
|
|
649
|
+
|
|
650
|
+
class IntegerDivide(BinaryIntegerOperator):
|
|
651
|
+
pass
|
|
652
|
+
|
|
653
|
+
class IntegerModulus(BinaryIntegerOperator):
|
|
654
|
+
pass
|
|
655
|
+
|
|
656
|
+
class RelationalOperator(BinaryOperator):
|
|
657
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
658
|
+
actual_type = formal_type
|
|
659
|
+
|
|
660
|
+
class Equal(RelationalOperator):
|
|
661
|
+
"="
|
|
662
|
+
pass
|
|
663
|
+
|
|
664
|
+
class NotEqual(RelationalOperator):
|
|
665
|
+
"<>"
|
|
666
|
+
pass
|
|
667
|
+
|
|
668
|
+
class LessThan(RelationalOperator):
|
|
669
|
+
"<"
|
|
670
|
+
pass
|
|
671
|
+
|
|
672
|
+
class LessThanEqual(RelationalOperator):
|
|
673
|
+
"<="
|
|
674
|
+
pass
|
|
675
|
+
|
|
676
|
+
class GreaterThan(RelationalOperator):
|
|
677
|
+
">"
|
|
678
|
+
pass
|
|
679
|
+
|
|
680
|
+
class GreaterThanEqual(RelationalOperator):
|
|
681
|
+
"<"
|
|
682
|
+
pass
|
|
683
|
+
|
|
684
|
+
class ShiftLeft(BinaryIntegerOperator):
|
|
685
|
+
"<<"
|
|
686
|
+
pass
|
|
687
|
+
|
|
688
|
+
class ShiftRight(BinaryIntegerOperator):
|
|
689
|
+
">>"
|
|
690
|
+
pass
|
|
691
|
+
|
|
692
|
+
class ShiftRightUnsigned(BinaryIntegerOperator):
|
|
693
|
+
"<<<"
|
|
694
|
+
pass
|
|
695
|
+
|
|
696
|
+
class And(BinaryIntegerOperator):
|
|
697
|
+
"AND"
|
|
698
|
+
pass
|
|
699
|
+
|
|
700
|
+
class Or(BinaryIntegerOperator):
|
|
701
|
+
"OR"
|
|
702
|
+
pass
|
|
703
|
+
|
|
704
|
+
class Eor(BinaryIntegerOperator):
|
|
705
|
+
"EOR"
|
|
706
|
+
pass
|
|
707
|
+
|
|
708
|
+
class AbsFunc(AstNode):
|
|
709
|
+
"ABS"
|
|
710
|
+
formal_type = TypeOption(NumericOwlType())
|
|
711
|
+
factor = Node(formalType=NumericOwlType())
|
|
712
|
+
|
|
713
|
+
class EndValue(Value):
|
|
714
|
+
"END"
|
|
715
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
716
|
+
actual_type = formal_type
|
|
717
|
+
expression = Node()
|
|
718
|
+
|
|
719
|
+
class ExtValue(Value):
|
|
720
|
+
"EXT"
|
|
721
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
722
|
+
actual_type = formal_type
|
|
723
|
+
channel = Node()
|
|
724
|
+
|
|
725
|
+
class HimemValue(Value):
|
|
726
|
+
formal_type = TypeOption(IntegerOwlType()) # TODO: AddressOwlType ?
|
|
727
|
+
actual_type = formal_type
|
|
728
|
+
|
|
729
|
+
class LomemValue(Value):
|
|
730
|
+
formal_type = TypeOption(IntegerOwlType()) # TODO: AddressOwlType ?
|
|
731
|
+
actual_type = formal_type
|
|
732
|
+
|
|
733
|
+
class PageValue(Value):
|
|
734
|
+
formal_type = TypeOption(IntegerOwlType()) # TODO: AddressOwlType ?
|
|
735
|
+
actual_type = formal_type
|
|
736
|
+
|
|
737
|
+
class TimeValue(Value):
|
|
738
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
739
|
+
actual_type = formal_type
|
|
740
|
+
|
|
741
|
+
class TimeStrValue(Value):
|
|
742
|
+
formal_type = TypeOption(StringOwlType())
|
|
743
|
+
actual_type = formal_type
|
|
744
|
+
|
|
745
|
+
class PtrValue(Value):
|
|
746
|
+
channel = Node(formalType=ChannelOwlType())
|
|
747
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
748
|
+
actual_type = formal_type
|
|
749
|
+
|
|
750
|
+
class MidStrLValue(Value):
|
|
751
|
+
target = Node(nodeType=Variable, formalType=StringOwlType()) # TODO: This needs to constrained by the type checker to be a Variable : nodeType=Variable ?
|
|
752
|
+
position = Node(formalType=IntegerOwlType())
|
|
753
|
+
length = Node(formalType=IntegerOwlType())
|
|
754
|
+
|
|
755
|
+
class RightStrLValue(Value):
|
|
756
|
+
target = Node(nodeType=Variable, formalType=StringOwlType()) # TODO: This needs to constrained by the type checker to be a Variable : nodeType=Variable ?
|
|
757
|
+
length = Node(formalType=IntegerOwlType())
|
|
758
|
+
|
|
759
|
+
class LeftStrLValue(Value):
|
|
760
|
+
target = Node(nodeType=Variable, formalType=StringOwlType())
|
|
761
|
+
length = Node(formalType=IntegerOwlType())
|
|
762
|
+
|
|
763
|
+
class UnaryNumericFunc(AstNode):
|
|
764
|
+
formal_type = TypeOption(FloatOwlType())
|
|
765
|
+
actual_type = formal_type
|
|
766
|
+
factor = Node(formalType=NumericOwlType(), description="The parameter")
|
|
767
|
+
|
|
768
|
+
class UserFunc(AstNode):
|
|
769
|
+
formal_type = TypeOption(PendingOwlType())
|
|
770
|
+
actual_type = formal_type
|
|
771
|
+
name = StringOption()
|
|
772
|
+
actual_parameters = Node()
|
|
773
|
+
|
|
774
|
+
class AcsFunc(UnaryNumericFunc):
|
|
775
|
+
"ACS"
|
|
776
|
+
|
|
777
|
+
class AdvalFunc(AstNode):
|
|
778
|
+
"ADVAL"
|
|
779
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
780
|
+
actual_type = formal_type
|
|
781
|
+
factor = Node(formalType=IntegerOwlType())
|
|
782
|
+
|
|
783
|
+
class AscFunc(AstNode):
|
|
784
|
+
"ASC"
|
|
785
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
786
|
+
actual_type = formal_type
|
|
787
|
+
factor = Node(formalType=StringOwlType())
|
|
788
|
+
|
|
789
|
+
class AsnFunc(UnaryNumericFunc):
|
|
790
|
+
"ASN"
|
|
791
|
+
|
|
792
|
+
class AtnFunc(UnaryNumericFunc):
|
|
793
|
+
"ATN"
|
|
794
|
+
|
|
795
|
+
class BeatFunc(AstNode):
|
|
796
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
797
|
+
actual_type = formal_type
|
|
798
|
+
|
|
799
|
+
class BeatsFunc(AstNode):
|
|
800
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
801
|
+
actual_type = formal_type
|
|
802
|
+
|
|
803
|
+
class BgetFunc(AstNode):
|
|
804
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
805
|
+
actual_type = formal_type
|
|
806
|
+
channel = Node()
|
|
807
|
+
|
|
808
|
+
class ChrStrFunc(AstNode):
|
|
809
|
+
formal_type = TypeOption(StringOwlType())
|
|
810
|
+
actual_type = formal_type
|
|
811
|
+
factor = Node(formalType=IntegerOwlType())
|
|
812
|
+
|
|
813
|
+
class CosFunc(UnaryNumericFunc):
|
|
814
|
+
"COS"
|
|
815
|
+
|
|
816
|
+
class CountFunc(AstNode):
|
|
817
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
818
|
+
actual_type = formal_type
|
|
819
|
+
|
|
820
|
+
class DegFunc(UnaryNumericFunc):
|
|
821
|
+
"DEG"
|
|
822
|
+
|
|
823
|
+
class DimensionsFunc(AstNode):
|
|
824
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
825
|
+
actual_type = formal_type
|
|
826
|
+
array = Node(nodeType=Variable, formalType=Array)
|
|
827
|
+
|
|
828
|
+
class DimensionSizeFunc(AstNode):
|
|
829
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
830
|
+
actual_type = formal_type
|
|
831
|
+
array = Node(nodeType=Variable, formalType=Array)
|
|
832
|
+
dimension = Node(formalType=IntegerOwlType())
|
|
833
|
+
|
|
834
|
+
class EofFunc(AstNode):
|
|
835
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
836
|
+
actual_type = formal_type
|
|
837
|
+
channel = Node(formalType=ChannelOwlType())
|
|
838
|
+
|
|
839
|
+
class ErlFunc(AstNode):
|
|
840
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
841
|
+
actual_type = formal_type
|
|
842
|
+
|
|
843
|
+
class ErrFunc(AstNode):
|
|
844
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
845
|
+
actual_type = formal_type
|
|
846
|
+
|
|
847
|
+
class EvalFunc(AstNode):
|
|
848
|
+
"EVAL"
|
|
849
|
+
formal_type = TypeOption(ObjectOwlType())
|
|
850
|
+
actual_type = formal_type
|
|
851
|
+
factor = Node(formalType=StringOwlType())
|
|
852
|
+
|
|
853
|
+
class ExpFunc(UnaryNumericFunc):
|
|
854
|
+
"EXP"
|
|
855
|
+
|
|
856
|
+
class FalseFunc(AstNode):
|
|
857
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
858
|
+
actual_type = formal_type
|
|
859
|
+
|
|
860
|
+
class GetFunc(AstNode):
|
|
861
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
862
|
+
actual_type = formal_type
|
|
863
|
+
|
|
864
|
+
class GetStrFunc(AstNode):
|
|
865
|
+
formal_type = TypeOption(StringOwlType())
|
|
866
|
+
actual_type = formal_type
|
|
867
|
+
|
|
868
|
+
class GetStrFileFunc(AstNode):
|
|
869
|
+
formal_type = TypeOption(StringOwlType())
|
|
870
|
+
channel = Node(formalType=ChannelOwlType())
|
|
871
|
+
|
|
872
|
+
class InkeyFunc(AstNode):
|
|
873
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
874
|
+
actual_type = formal_type
|
|
875
|
+
factor = Node(formalType=IntegerOwlType())
|
|
876
|
+
|
|
877
|
+
class InkeyStrFunc(AstNode):
|
|
878
|
+
formal_type = TypeOption(StringOwlType())
|
|
879
|
+
actual_type = formal_type
|
|
880
|
+
factor = Node(formalType=IntegerOwlType())
|
|
881
|
+
|
|
882
|
+
class InstrFunc(AstNode):
|
|
883
|
+
"INSTR"
|
|
884
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
885
|
+
actual_type = formal_type
|
|
886
|
+
source = Node(formalType=StringOwlType())
|
|
887
|
+
sub_string = Node(formalType=StringOwlType())
|
|
888
|
+
start_position = Node(formalType=IntegerOwlType())
|
|
889
|
+
|
|
890
|
+
class IntFunc(AstNode):
|
|
891
|
+
"INT"
|
|
892
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
893
|
+
actual_type = formal_type
|
|
894
|
+
factor = Node(formalType=FloatOwlType())
|
|
895
|
+
|
|
896
|
+
class LeftStrFunc(AstNode):
|
|
897
|
+
formal_type = TypeOption(StringOwlType())
|
|
898
|
+
actual_type = formal_type
|
|
899
|
+
source = Node()
|
|
900
|
+
length = Node(formalType=IntegerOwlType())
|
|
901
|
+
|
|
902
|
+
class LenFunc(AstNode):
|
|
903
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
904
|
+
actual_type = formal_type
|
|
905
|
+
factor = Node(formalType=StringOwlType())
|
|
906
|
+
|
|
907
|
+
class LnFunc(UnaryNumericFunc):
|
|
908
|
+
"LN"
|
|
909
|
+
|
|
910
|
+
class LogFunc(UnaryNumericFunc):
|
|
911
|
+
"LOG"
|
|
912
|
+
|
|
913
|
+
class MidStrFunc(AstNode):
|
|
914
|
+
formal_type = TypeOption(StringOwlType())
|
|
915
|
+
actual_type = formal_type
|
|
916
|
+
source = Node(formalType=StringOwlType())
|
|
917
|
+
position = Node(formalType=IntegerOwlType())
|
|
918
|
+
length = Node(formalType=IntegerOwlType())
|
|
919
|
+
|
|
920
|
+
class ModeFunc(AstNode):
|
|
921
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
922
|
+
|
|
923
|
+
class OpeninFunc(AstNode):
|
|
924
|
+
formal_type = TypeOption(ChannelOwlType())
|
|
925
|
+
filename = Node(formalType=StringOwlType())
|
|
926
|
+
|
|
927
|
+
class OpenoutFunc(AstNode):
|
|
928
|
+
formal_type = TypeOption(ChannelOwlType())
|
|
929
|
+
filename = Node(formalType=StringOwlType())
|
|
930
|
+
|
|
931
|
+
class OpenupFunc(AstNode):
|
|
932
|
+
formal_type = TypeOption(ChannelOwlType())
|
|
933
|
+
filename = Node(formalType=StringOwlType())
|
|
934
|
+
|
|
935
|
+
class PosFunc(AstNode):
|
|
936
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
937
|
+
actual_type = formal_type
|
|
938
|
+
|
|
939
|
+
class PiFunc(AstNode):
|
|
940
|
+
formal_type = TypeOption(FloatOwlType())
|
|
941
|
+
actual_type = formal_type
|
|
942
|
+
|
|
943
|
+
class PointFunc(AstNode):
|
|
944
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
945
|
+
x_coord = Node(formalType=IntegerOwlType())
|
|
946
|
+
y_coord = Node(formalType=IntegerOwlType())
|
|
947
|
+
|
|
948
|
+
class QuitFunc(AstNode):
|
|
949
|
+
"QUIT"
|
|
950
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
951
|
+
actual_type = formal_type
|
|
952
|
+
|
|
953
|
+
class RadFunc(UnaryNumericFunc):
|
|
954
|
+
"RAD"
|
|
955
|
+
|
|
956
|
+
class ReadFunc(AstNode):
|
|
957
|
+
"READ"
|
|
958
|
+
formal_type = TypeOption(ScalarOwlType())
|
|
959
|
+
actual_type = formal_type
|
|
960
|
+
|
|
961
|
+
class ReportStrFunc(AstNode):
|
|
962
|
+
"REPORT$"
|
|
963
|
+
formal_type = TypeOption(StringOwlType())
|
|
964
|
+
actual_type = formal_type
|
|
965
|
+
|
|
966
|
+
class RightStrFunc(AstNode):
|
|
967
|
+
formal_type = TypeOption(StringOwlType())
|
|
968
|
+
actual_type = formal_type
|
|
969
|
+
source = Node(formalType=StringOwlType())
|
|
970
|
+
length = Node(formalType=IntegerOwlType())
|
|
971
|
+
|
|
972
|
+
class RndFunc(AstNode):
|
|
973
|
+
"RND"
|
|
974
|
+
# A minor change from BBC BASIC. In BBC BASIC RND(x) can return
|
|
975
|
+
# either a float or integer. In OWL BASIC we always return a
|
|
976
|
+
# 64-bit float.
|
|
977
|
+
formal_type = TypeOption(FloatOwlType())
|
|
978
|
+
actual_type = formal_type
|
|
979
|
+
option = Node(formalType=IntegerOwlType())
|
|
980
|
+
|
|
981
|
+
class SinFunc(UnaryNumericFunc):
|
|
982
|
+
"SIN"
|
|
983
|
+
|
|
984
|
+
class SgnFunc(AstNode):
|
|
985
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
986
|
+
actual_type = formal_type
|
|
987
|
+
factor = Node(formalType=NumericOwlType())
|
|
988
|
+
|
|
989
|
+
class SqrFunc(UnaryNumericFunc):
|
|
990
|
+
"SQR"
|
|
991
|
+
|
|
992
|
+
class StrStringFunc(AstNode):
|
|
993
|
+
formal_type = TypeOption(StringOwlType())
|
|
994
|
+
actual_type = formal_type
|
|
995
|
+
base = IntegerOption(10)
|
|
996
|
+
factor = Node(formalType=NumericOwlType())
|
|
997
|
+
|
|
998
|
+
class Sum(AstNode):
|
|
999
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
1000
|
+
array = Node(formalType=ArrayOwlType())
|
|
1001
|
+
|
|
1002
|
+
class SumLenFunc(AstNode):
|
|
1003
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
1004
|
+
array = Node(formalType=ArrayOwlType())
|
|
1005
|
+
|
|
1006
|
+
class TanFunc(UnaryNumericFunc):
|
|
1007
|
+
"TAN"
|
|
1008
|
+
|
|
1009
|
+
class TempoFunc(AstNode):
|
|
1010
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
1011
|
+
actual_type = formal_type
|
|
1012
|
+
|
|
1013
|
+
class TintFunc(AstNode):
|
|
1014
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
1015
|
+
actual_type = formal_type
|
|
1016
|
+
x_coord = Node(formalType=IntegerOwlType())
|
|
1017
|
+
y_coord = Node(formalType=IntegerOwlType())
|
|
1018
|
+
|
|
1019
|
+
class TopFunc(AstNode):
|
|
1020
|
+
formal_type = TypeOption(IntegerOwlType()) # TODO: AddressOwlType?
|
|
1021
|
+
actual_type = formal_type
|
|
1022
|
+
|
|
1023
|
+
class TrueFunc(AstNode):
|
|
1024
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
1025
|
+
actual_type = formal_type
|
|
1026
|
+
|
|
1027
|
+
class ValFunc(AstNode):
|
|
1028
|
+
formal_type = TypeOption(FloatOwlType())
|
|
1029
|
+
actual_type = formal_type
|
|
1030
|
+
factor = Node(formalType=StringOwlType())
|
|
1031
|
+
|
|
1032
|
+
class VposFunc(AstNode):
|
|
1033
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
1034
|
+
actual_type = formal_type
|
|
1035
|
+
|
|
1036
|
+
class WidthFunc(AstNode):
|
|
1037
|
+
formal_type = TypeOption(IntegerOwlType())
|
|
1038
|
+
actual_type = formal_type
|
|
1039
|
+
|
|
1040
|
+
class Line(AstStatement):
|
|
1041
|
+
x1_coord = Node(formalType=IntegerOwlType())
|
|
1042
|
+
y1_coord = Node(formalType=IntegerOwlType())
|
|
1043
|
+
x2_coord = Node(formalType=IntegerOwlType())
|
|
1044
|
+
y2_coord = Node(formalType=IntegerOwlType())
|
|
1045
|
+
|
|
1046
|
+
class LiteralString(AstNode):
|
|
1047
|
+
actual_type = TypeOption(StringOwlType())
|
|
1048
|
+
value = StringOption()
|
|
1049
|
+
|
|
1050
|
+
class LiteralInteger(AstNode):
|
|
1051
|
+
actual_type = TypeOption(IntegerOwlType())
|
|
1052
|
+
value = IntegerOption()
|
|
1053
|
+
|
|
1054
|
+
class LiteralFloat(AstNode):
|
|
1055
|
+
actual_type = TypeOption(FloatOwlType())
|
|
1056
|
+
value = FloatOption()
|
|
1057
|
+
|
|
1058
|
+
# Implicit AST nodes
|
|
1059
|
+
class Concatenate(AstNode):
|
|
1060
|
+
formal_type = TypeOption(StringOwlType())
|
|
1061
|
+
actual_type = formal_type
|
|
1062
|
+
lhs = Node(formalType=StringOwlType())
|
|
1063
|
+
rhs = Node(formalType=StringOwlType())
|
|
1064
|
+
|
|
1065
|
+
class Cast(AstNode):
|
|
1066
|
+
"Implicit Conversion"
|
|
1067
|
+
formal_type = TypeOption()
|
|
1068
|
+
source_type = TypeOption()
|
|
1069
|
+
target_type = TypeOption()
|
|
1070
|
+
value = Node()
|
|
1071
|
+
|
|
1072
|
+
class Raise(AstStatement):
|
|
1073
|
+
"Raise exception"
|
|
1074
|
+
type = StringOption()
|
|
1075
|
+
|
|
1076
|
+
class LongJump(AstStatement):
|
|
1077
|
+
"Long jump"
|
|
1078
|
+
target_logical_line = Node(formalType=IntegerOwlType())
|
|
1079
|
+
|
|
1080
|
+
class StarCommand(AstStatement):
|
|
1081
|
+
command = StringOption()
|