annotate python/ppci/assembler.py @ 365:98ff43cfdd36

Nasty bug in adr instruction
author Windel Bouwman
date Wed, 19 Mar 2014 22:32:04 +0100
parents 3bb7dcfe5529
children 19eacf4f7270
rev   line source
334
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
1
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
2 import re
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
3 import pyyacc
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
4 from . import Token, CompilerError, SourceLocation
342
86b02c98a717 Moved target directory
Windel Bouwman
parents: 341
diff changeset
5 from .target import Target, Label
334
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
6
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 337
diff changeset
7
341
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
8 def bit_type(value):
345
b4882ff0ed06 Added more arm isa tests
Windel Bouwman
parents: 342
diff changeset
9 assert value < (2**32)
341
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
10 assert value >= 0
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
11 t = 'val32'
345
b4882ff0ed06 Added more arm isa tests
Windel Bouwman
parents: 342
diff changeset
12 for n in [16, 12, 8, 5, 3]:
341
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
13 if value < (2**n):
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
14 t = 'val{}'.format(n)
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
15 return t
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
16
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
17 def tokenize(s, kws):
334
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
18 """
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
19 Tokenizer, generates an iterator that
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
20 returns tokens!
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
21
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
22 This GREAT example was taken from python re doc page!
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
23 """
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
24 tok_spec = [
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
25 ('REAL', r'\d+\.\d+'),
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
26 ('HEXNUMBER', r'0x[\da-fA-F]+'),
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
27 ('NUMBER', r'\d+'),
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
28 ('ID', r'[A-Za-z][A-Za-z\d_]*'),
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
29 ('SKIP', r'[ \t]'),
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
30 ('LEESTEKEN', r':=|[\.,=:\-+*\[\]/\(\)]|>=|<=|<>|>|<|}|{'),
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
31 ('STRING', r"'.*?'"),
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
32 ('COMMENT', r";.*")
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
33 ]
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
34 tok_re = '|'.join('(?P<%s>%s)' % pair for pair in tok_spec)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
35 gettok = re.compile(tok_re).match
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
36 line = 1
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
37 pos = line_start = 0
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
38 mo = gettok(s)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
39 while mo is not None:
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
40 typ = mo.lastgroup
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
41 val = mo.group(typ)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
42 if typ == 'NEWLINE':
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
43 line_start = pos
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
44 line += 1
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
45 elif typ != 'SKIP':
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
46 if typ == 'LEESTEKEN':
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
47 typ = val
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
48 elif typ == 'NUMBER':
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
49 val = int(val)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
50 elif typ == 'HEXNUMBER':
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
51 val = int(val[2:], 16)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
52 typ = 'NUMBER'
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
53 elif typ == 'REAL':
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
54 val = float(val)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
55 elif typ == 'STRING':
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
56 val = val[1:-1]
341
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
57 elif typ == 'ID':
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
58 if val.lower() in kws: # ['r3', 'sp', 'add', 'yield', 'r4', 'r0', 'r1', 'sub', 'r5', 'r6', 'r2']:
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
59 typ = val.lower()
334
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
60 col = mo.start() - line_start
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
61 loc = SourceLocation('', line, col, 0) # TODO retrieve length?
341
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
62 if typ == 'NUMBER':
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
63 typ = bit_type(val)
334
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
64 yield Token(typ, val, loc)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
65 pos = mo.end()
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
66 mo = gettok(s, pos)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
67 if pos != len(s):
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
68 col = pos - line_start
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
69 loc = SourceLocation('', line, col, 0)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
70 raise CompilerError('Unexpected character {0}'.format(s[pos]), loc)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
71 yield Token('EOF', pyyacc.EOF)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
72
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
73
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
74 class Lexer:
341
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
75 def __init__(self, src, kws):
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
76 self.tokens = tokenize(src, kws)
334
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
77 self.curTok = self.tokens.__next__()
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
78
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
79 def next_token(self):
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
80 t = self.curTok
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
81 if t.typ != 'EOF':
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
82 self.curTok = self.tokens.__next__()
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
83 return t
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
84
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
85
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
86 class Parser:
341
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
87 def add_rule(self, prod, rhs, f):
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
88 """ Helper function to add a rule, why this is required? """
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
89 if prod == 'instruction':
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
90 def f_wrap(*args):
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
91 i = f(args)
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
92 self.emit(i)
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
93 else:
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
94 def f_wrap(*rhs):
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
95 return f(rhs)
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
96 self.g.add_production(prod, rhs, f_wrap)
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
97
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
98 def __init__(self, kws, instruction_rules, emit):
334
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
99 # Construct a parser given a grammar:
341
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
100 tokens2 = ['ID', 'NUMBER', ',', '[', ']', ':', '+', '-', '*',
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
101 pyyacc.EPS, 'COMMENT', '{', '}',
345
b4882ff0ed06 Added more arm isa tests
Windel Bouwman
parents: 342
diff changeset
102 pyyacc.EOF, 'val32', 'val16', 'val12', 'val8', 'val5', 'val3']
341
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
103 tokens2.extend(kws)
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
104 self.kws = kws
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
105 g = pyyacc.Grammar(tokens2)
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
106 self.g = g
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 337
diff changeset
107 # Global structure of assembly line:
334
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
108 g.add_production('asmline', ['asmline2'])
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
109 g.add_production('asmline', ['asmline2', 'COMMENT'])
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
110 g.add_production('asmline2', ['label', 'instruction'])
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
111 g.add_production('asmline2', ['instruction'])
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
112 g.add_production('asmline2', ['label'])
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
113 g.add_production('asmline2', [])
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
114 g.add_production('label', ['ID', ':'], self.p_label)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
115 #g.add_production('label', [])
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 337
diff changeset
116
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 337
diff changeset
117 # Add instruction rules for the target in question:
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 337
diff changeset
118 for prod, rhs, f in instruction_rules:
341
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
119 self.add_rule(prod, rhs, f)
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 337
diff changeset
120
334
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
121 #g.add_production('instruction', [])
341
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
122 g.add_production('expression', ['term'], lambda x: x)
334
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
123 g.add_production('expression', ['expression', 'addop', 'term'], self.p_binop)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
124 g.add_production('addop', ['-'], lambda x: x.val)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
125 g.add_production('addop', ['+'], lambda x: x.val)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
126 g.add_production('mulop', ['*'], lambda x: x.val)
341
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
127 g.add_production('term', ['factor'], lambda x: x)
334
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
128 g.add_production('term', ['term', 'mulop', 'factor'], self.p_binop)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
129 g.add_production('factor', ['ID'], lambda name: ASymbol(name.val))
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
130 g.add_production('factor', ['NUMBER'], lambda num: ANumber(int(num.val)))
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
131 g.start_symbol = 'asmline'
341
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
132 self.emit = emit
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
133 self.p = g.generate_parser()
342
86b02c98a717 Moved target directory
Windel Bouwman
parents: 341
diff changeset
134 # print('length of table:', len(self.p.action_table))
334
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
135
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
136 # Parser handlers:
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
137 def p_ins_1(self, opc, ops):
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
138 ins = AInstruction(opc, ops)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
139 self.emit(ins)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
140
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
141 def p_ins_2(self, opc):
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
142 self.p_ins_1(opc, [])
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
143
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
144 def p_operands_1(self, op1):
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
145 return [op1]
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
146
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
147 def p_operands_2(self, ops, comma, op2):
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
148 assert type(ops) is list
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
149 ops.append(op2)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
150 return ops
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
151
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
152 def p_listitems_1(self, li1):
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
153 return [li1]
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
154
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
155 def p_listitems_2(self, lis, comma, li2):
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
156 assert type(lis) is list
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
157 lis.append(li2)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
158 return lis
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
159
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
160 def p_list_op(self, brace_open, lst, brace_close):
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
161 return AUnop('{}', lst)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
162
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
163 def p_mem_op(self, brace_open, exp, brace_close):
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
164 return AUnop('[]', exp)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
165
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
166 def p_label(self, lname, cn):
341
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
167 lab = Label(lname.val)
334
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
168 self.emit(lab)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
169
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
170 def p_binop(self, exp1, op, exp2):
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
171 return ABinop(op, exp1, exp2)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
172
341
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
173 def parse(self, lexer):
334
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
174 self.p.parse(lexer)
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
175
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
176
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
177 class Assembler:
346
3bb7dcfe5529 expanded arm target
Windel Bouwman
parents: 345
diff changeset
178 def __init__(self, target):
334
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
179 self.target = target
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 337
diff changeset
180 assert isinstance(target, Target)
346
3bb7dcfe5529 expanded arm target
Windel Bouwman
parents: 345
diff changeset
181 self.parser = Parser(target.asm_keywords, target.assembler_rules, self.emit)
3bb7dcfe5529 expanded arm target
Windel Bouwman
parents: 345
diff changeset
182
3bb7dcfe5529 expanded arm target
Windel Bouwman
parents: 345
diff changeset
183 def emit(self, *args):
3bb7dcfe5529 expanded arm target
Windel Bouwman
parents: 345
diff changeset
184 self.stream.emit(*args)
334
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
185
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
186 # Top level interface:
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
187 def parse_line(self, line):
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 337
diff changeset
188 """ Parse line into assembly instructions """
341
4d204f6f7d4e Rewrite of assembler parts
Windel Bouwman
parents: 340
diff changeset
189 tokens = Lexer(line, self.target.asm_keywords)
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 337
diff changeset
190 self.parser.parse(tokens)
334
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
191
346
3bb7dcfe5529 expanded arm target
Windel Bouwman
parents: 345
diff changeset
192 def assemble(self, asmsrc, stream):
334
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
193 """ Assemble this source snippet """
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 337
diff changeset
194 if hasattr(asmsrc, 'read'):
334
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
195 asmsrc2 = asmsrc.read()
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
196 asmsrc.close()
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
197 asmsrc = asmsrc2
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 337
diff changeset
198 # TODO: use generic newline??
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 337
diff changeset
199 # TODO: the bothersome newline ...
346
3bb7dcfe5529 expanded arm target
Windel Bouwman
parents: 345
diff changeset
200 self.stream = stream
334
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
201 for line in asmsrc.split('\n'):
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 337
diff changeset
202 self.parse_line(line)
346
3bb7dcfe5529 expanded arm target
Windel Bouwman
parents: 345
diff changeset
203 self.stream = None
334
6f4753202b9a Added more recipes
Windel Bouwman
parents:
diff changeset
204