diff --git a/src/sixtypical/analyzer.py b/src/sixtypical/analyzer.py index ecb3b57..11c21ff 100644 --- a/src/sixtypical/analyzer.py +++ b/src/sixtypical/analyzer.py @@ -372,23 +372,23 @@ class Analyzer(object): context = Context(self.routines, routine, type_.inputs, type_.outputs, type_.trashes) if self.debug: - print "at start of routine `{}`:".format(routine.name) - print context + print("at start of routine `{}`:".format(routine.name)) + print(context) self.analyze_block(routine.block, context) trashed = set(context.each_touched()) - set(context.each_meaningful()) if self.debug: - print "at end of routine `{}`:".format(routine.name) - print context - print "trashed: ", LocationRef.format_set(trashed) - print "outputs: ", LocationRef.format_set(type_.outputs) + print("at end of routine `{}`:".format(routine.name)) + print(context) + print("trashed: ", LocationRef.format_set(trashed)) + print("outputs: ", LocationRef.format_set(type_.outputs)) trashed_outputs = type_.outputs & trashed if trashed_outputs: - print "TRASHED OUTPUTS: ", LocationRef.format_set(trashed_outputs) - print '' - print '-' * 79 - print '' + print("TRASHED OUTPUTS: ", LocationRef.format_set(trashed_outputs)) + print('') + print('-' * 79) + print('') # even if we goto another routine, we can't trash an output. for ref in trashed: diff --git a/src/sixtypical/compiler.py b/src/sixtypical/compiler.py index 34ed70f..be610b8 100644 --- a/src/sixtypical/compiler.py +++ b/src/sixtypical/compiler.py @@ -112,7 +112,7 @@ class Compiler(object): routine_name = roster_row[-1] self.compile_routine(self.routines[routine_name]) - for location, label in self.trampolines.iteritems(): + for location, label in self.trampolines.items(): self.emitter.resolve_label(label) self.emitter.emit(JMP(Indirect(self.get_label(location.name)))) self.emitter.emit(RTS()) diff --git a/src/sixtypical/emitter.py b/src/sixtypical/emitter.py index a1b962c..6ea308a 100644 --- a/src/sixtypical/emitter.py +++ b/src/sixtypical/emitter.py @@ -13,7 +13,7 @@ class Emittable(object): class Byte(Emittable): def __init__(self, value): - if isinstance(value, basestring): + if isinstance(value, str): value = ord(value) if value < -127 or value > 255: raise IndexError(value) diff --git a/src/sixtypical/model.py b/src/sixtypical/model.py index 30d5d54..6effc49 100644 --- a/src/sixtypical/model.py +++ b/src/sixtypical/model.py @@ -20,7 +20,7 @@ class Type(object): def backpatch_constraint_labels(self, resolver): def resolve(w): - if not isinstance(w, basestring): + if not isinstance(w, str): return w return resolver(w) if isinstance(self, TableType): diff --git a/src/sixtypical/parser.py b/src/sixtypical/parser.py index e16cf66..8cee87a 100644 --- a/src/sixtypical/parser.py +++ b/src/sixtypical/parser.py @@ -90,7 +90,7 @@ class Parser(object): self.scanner.check_type('EOF') # now backpatch the executable types. - #for type_name, type_ in self.context.typedefs.iteritems(): + #for type_name, type_ in self.context.typedefs.items(): # type_.backpatch_constraint_labels(lambda w: self.lookup(w)) for defn in defns: defn.location.type.backpatch_constraint_labels(lambda w: self.lookup(w)) @@ -103,7 +103,7 @@ class Parser(object): if not isinstance(model.type, (RoutineType, VectorType)): self.syntax_error('Illegal call of non-executable "%s"' % name) instr.location = model - if instr.opcode in ('copy',) and isinstance(instr.src, basestring): + if instr.opcode in ('copy',) and isinstance(instr.src, str): name = instr.src model = self.lookup(name) if not isinstance(model.type, (RoutineType, VectorType)): @@ -359,7 +359,7 @@ class Parser(object): def indexed_locexpr(self, forward=False): loc = self.locexpr(forward=forward) - if not isinstance(loc, basestring): + if not isinstance(loc, str): index = None if self.scanner.consume('+'): index = self.locexpr()