comparison python/ppci/c3/astnodes.py @ 316:56e6ff84f646

Fixed burn led demo
author Windel Bouwman
date Sat, 21 Dec 2013 13:13:26 +0100
parents 084cccaa5deb
children d1ecc493384e
comparison
equal deleted inserted replaced
315:084cccaa5deb 316:56e6ff84f646
83 def __repr__(self): 83 def __repr__(self):
84 return '({}*)'.format(self.ptype) 84 return '({}*)'.format(self.ptype)
85 85
86 86
87 class StructField: 87 class StructField:
88 """ Field of a struct type """
88 def __init__(self, name, typ): 89 def __init__(self, name, typ):
89 assert type(name) is str 90 assert type(name) is str
90 self.name = name 91 self.name = name
91 self.typ = typ 92 self.typ = typ
92 self.offset = 0
93 93
94 94
95 class StructureType(Type): 95 class StructureType(Type):
96 """ Struct type consisting of several named members """ 96 """ Struct type consisting of several named members """
97 def __init__(self, mems): 97 def __init__(self, mems):
131 def __repr__(self): 131 def __repr__(self):
132 return 'Named type {0} of type {1}'.format(self.name, self.typ) 132 return 'Named type {0} of type {1}'.format(self.name, self.typ)
133 133
134 134
135 class Constant(Symbol): 135 class Constant(Symbol):
136 """ Constant definition """
136 def __init__(self, name, typ, value): 137 def __init__(self, name, typ, value):
137 super().__init__(name) 138 super().__init__(name)
138 self.typ = typ 139 self.typ = typ
139 self.value = value 140 self.value = value
140 141
145 class Variable(Symbol): 146 class Variable(Symbol):
146 def __init__(self, name, typ): 147 def __init__(self, name, typ):
147 super().__init__(name) 148 super().__init__(name)
148 self.typ = typ 149 self.typ = typ
149 self.isLocal = False 150 self.isLocal = False
150 self.isReadOnly = False
151 self.isParameter = False 151 self.isParameter = False
152 152
153 def __repr__(self): 153 def __repr__(self):
154 return 'Var {} [{}]'.format(self.name, self.typ) 154 return 'Var {} [{}]'.format(self.name, self.typ)
155 155