Mercurial > lcfOS
comparison python/asmnodes.py @ 203:ca1ea402f6a1
Added some arm instructions
author | Windel Bouwman |
---|---|
date | Sat, 15 Jun 2013 19:13:05 +0200 |
parents | d5debbfc0200 |
children | 6c6bf8890d8a |
comparison
equal
deleted
inserted
replaced
202:f22b431f4113 | 203:ca1ea402f6a1 |
---|---|
10 self.name = name | 10 self.name = name |
11 def __repr__(self): | 11 def __repr__(self): |
12 return '{0}:'.format(self.name) | 12 return '{0}:'.format(self.name) |
13 | 13 |
14 class AInstruction(ANode): | 14 class AInstruction(ANode): |
15 def __init__(self, opcode, operands): | 15 def __init__(self, mnemonic, operands): |
16 self.opcode = opcode | 16 self.mnemonic = mnemonic |
17 self.operands = operands | 17 self.operands = operands |
18 def __repr__(self): | 18 def __repr__(self): |
19 ops = ', '.join(map(str, self.operands)) | 19 ops = ', '.join(map(str, self.operands)) |
20 return '{0} {1}'.format(self.opcode, ops) | 20 return '{0} {1}'.format(self.mnemonic, ops) |
21 | 21 |
22 class AExpression(ANode): | 22 class AExpression(ANode): |
23 def __add__(self, other): | 23 def __add__(self, other): |
24 assert isinstance(other, AExpression) | 24 assert isinstance(other, AExpression) |
25 return ABinop('+', self, other) | 25 return ABinop('+', self, other) |