git @ Cat's Eye Technologies SixtyPical / c11869f
Not making any promises, but reduce the errors under Python 3. Chris Pressey 6 years ago
5 changed file(s) with 16 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
371371 context = Context(self.routines, routine, type_.inputs, type_.outputs, type_.trashes)
372372
373373 if self.debug:
374 print "at start of routine `{}`:".format(routine.name)
375 print context
374 print("at start of routine `{}`:".format(routine.name))
375 print(context)
376376
377377 self.analyze_block(routine.block, context)
378378 trashed = set(context.each_touched()) - set(context.each_meaningful())
379379
380380 if self.debug:
381 print "at end of routine `{}`:".format(routine.name)
382 print context
383 print "trashed: ", LocationRef.format_set(trashed)
384 print "outputs: ", LocationRef.format_set(type_.outputs)
381 print("at end of routine `{}`:".format(routine.name))
382 print(context)
383 print("trashed: ", LocationRef.format_set(trashed))
384 print("outputs: ", LocationRef.format_set(type_.outputs))
385385 trashed_outputs = type_.outputs & trashed
386386 if trashed_outputs:
387 print "TRASHED OUTPUTS: ", LocationRef.format_set(trashed_outputs)
388 print ''
389 print '-' * 79
390 print ''
387 print("TRASHED OUTPUTS: ", LocationRef.format_set(trashed_outputs))
388 print('')
389 print('-' * 79)
390 print('')
391391
392392 # even if we goto another routine, we can't trash an output.
393393 for ref in trashed:
111111 routine_name = roster_row[-1]
112112 self.compile_routine(self.routines[routine_name])
113113
114 for location, label in self.trampolines.iteritems():
114 for location, label in self.trampolines.items():
115115 self.emitter.resolve_label(label)
116116 self.emitter.emit(JMP(Indirect(self.get_label(location.name))))
117117 self.emitter.emit(RTS())
1212
1313 class Byte(Emittable):
1414 def __init__(self, value):
15 if isinstance(value, basestring):
15 if isinstance(value, str):
1616 value = ord(value)
1717 if value < -127 or value > 255:
1818 raise IndexError(value)
1919
2020 def backpatch_constraint_labels(self, resolver):
2121 def resolve(w):
22 if not isinstance(w, basestring):
22 if not isinstance(w, str):
2323 return w
2424 return resolver(w)
2525 if isinstance(self, TableType):
8989 self.scanner.check_type('EOF')
9090
9191 # now backpatch the executable types.
92 #for type_name, type_ in self.context.typedefs.iteritems():
92 #for type_name, type_ in self.context.typedefs.items():
9393 # type_.backpatch_constraint_labels(lambda w: self.lookup(w))
9494 for defn in defns:
9595 defn.location.type.backpatch_constraint_labels(lambda w: self.lookup(w))
102102 if not isinstance(model.type, (RoutineType, VectorType)):
103103 self.syntax_error('Illegal call of non-executable "%s"' % name)
104104 instr.location = model
105 if instr.opcode in ('copy',) and isinstance(instr.src, basestring):
105 if instr.opcode in ('copy',) and isinstance(instr.src, str):
106106 name = instr.src
107107 model = self.lookup(name)
108108 if not isinstance(model.type, (RoutineType, VectorType)):
358358
359359 def indexed_locexpr(self, forward=False):
360360 loc = self.locexpr(forward=forward)
361 if not isinstance(loc, basestring):
361 if not isinstance(loc, str):
362362 index = None
363363 if self.scanner.consume('+'):
364364 index = self.locexpr()