Mercurial > lcfOS
comparison python/ppci/ir.py @ 354:5477e499b039
Added some sort of string functionality
author | Windel Bouwman |
---|---|
date | Thu, 13 Mar 2014 18:59:06 +0100 |
parents | d1ecc493384e |
children | 396e5cefba13 |
comparison
equal
deleted
inserted
replaced
353:b8ad45b3a573 | 354:5477e499b039 |
---|---|
212 assert type(f) is str | 212 assert type(f) is str |
213 self.f = f | 213 self.f = f |
214 self.arguments = arguments | 214 self.arguments = arguments |
215 | 215 |
216 def __repr__(self): | 216 def __repr__(self): |
217 args = ', '.join([str(arg) for arg in self.arguments]) | 217 args = ', '.join(str(arg) for arg in self.arguments) |
218 return '{}({})'.format(self.f, args) | 218 return '{}({})'.format(self.f, args) |
219 | 219 |
220 | 220 |
221 # Data operations | 221 # Data operations |
222 class Binop(Expression): | 222 class Binop(Expression): |
305 def __init__(self, e): | 305 def __init__(self, e): |
306 self.e = e | 306 self.e = e |
307 | 307 |
308 def __repr__(self): | 308 def __repr__(self): |
309 return '[{}]'.format(self.e) | 309 return '[{}]'.format(self.e) |
310 | |
311 | |
312 class Addr(Expression): | |
313 """ Address of label """ | |
314 def __init__(self, e): | |
315 self.e = e | |
316 | |
317 def __repr__(self): | |
318 return '&{}'.format(self.e) | |
310 | 319 |
311 | 320 |
312 class Statement: | 321 class Statement: |
313 """ Base class for all instructions. """ | 322 """ Base class for all instructions. """ |
314 @property | 323 @property |