Mercurial > lcfOS
comparison python/ppci/ir.py @ 377:9667d78ba79e
Switched to xml for project description
author | Windel Bouwman |
---|---|
date | Fri, 11 Apr 2014 15:47:50 +0200 |
parents | c49459768aaa |
children | 988f3fb861e4 |
comparison
equal
deleted
inserted
replaced
376:1e951e71d3f1 | 377:9667d78ba79e |
---|---|
39 def get_variables(self): | 39 def get_variables(self): |
40 return self.variables | 40 return self.variables |
41 | 41 |
42 Variables = property(get_variables) | 42 Variables = property(get_variables) |
43 | 43 |
44 def getFunctions(self): | 44 def get_functions(self): |
45 return self.functions | 45 return self.functions |
46 | 46 |
47 Functions = property(getFunctions) | 47 Functions = property(get_functions) |
48 | 48 |
49 def findFunction(self, name): | 49 def findFunction(self, name): |
50 for f in self.funcs: | 50 for f in self.funcs: |
51 if f.name == name: | 51 if f.name == name: |
52 return f | 52 return f |
192 raise NotImplementedError() | 192 raise NotImplementedError() |
193 | 193 |
194 | 194 |
195 # Instructions: | 195 # Instructions: |
196 | 196 |
197 class Value: | |
198 pass | |
199 | |
197 class Expression: | 200 class Expression: |
198 """ Base class for an expression """ | 201 """ Base class for an expression """ |
199 pass | 202 pass |
200 | 203 |
201 | 204 |
225 """ Generic binary operation """ | 228 """ Generic binary operation """ |
226 ops = ['+', '-', '*', '/', '|', '&', '<<', '>>'] | 229 ops = ['+', '-', '*', '/', '|', '&', '<<', '>>'] |
227 | 230 |
228 def __init__(self, value1, operation, value2): | 231 def __init__(self, value1, operation, value2): |
229 assert operation in Binop.ops | 232 assert operation in Binop.ops |
233 #assert type(value1) is type(value2) | |
230 self.a = value1 | 234 self.a = value1 |
231 self.b = value2 | 235 self.b = value2 |
232 self.operation = operation | 236 self.operation = operation |
233 | 237 |
234 def __repr__(self): | 238 def __repr__(self): |