-#!/usr/bin/env python
# (C) Copyright IBM Corporation 2005
# All Rights Reserved.
# Authors:
# Ian Romanick <idr@us.ibm.com>
-import string, copy
+from __future__ import print_function
-class type_node:
+import copy
+
+class type_node(object):
def __init__(self):
self.pointer = 0 # bool
self.const = 0 # bool
return s
-class type_table:
+class type_table(object):
def __init__(self):
self.types_by_name = {}
return
return
-class type_expression:
+class type_expression(object):
built_in_types = None
def __init__(self, type_string, extra_types = None):
# Replace '*' with ' * ' in type_string. Then, split the string
# into tokens, separated by spaces.
- tokens = string.split( string.replace( type_string, "*", " * " ) )
+ tokens = type_string.replace("*", " * ").split()
const = 0
t = None
create_initial_types()
for t in types_to_try:
- print 'Trying "%s"...' % (t)
+ print('Trying "%s"...' % (t))
te = type_expression( t )
- print 'Got "%s" (%u, %u).' % (te.string(), te.get_stack_size(), te.get_element_size())
+ print('Got "%s" (%u, %u).' % (te.string(), te.get_stack_size(), te.get_element_size()))