diff python/ppci/assembler.py @ 342:86b02c98a717 devel

Moved target directory
author Windel Bouwman
date Sat, 01 Mar 2014 15:40:31 +0100
parents 4d204f6f7d4e
children b4882ff0ed06
line wrap: on
line diff
--- a/python/ppci/assembler.py	Fri Feb 28 18:07:14 2014 +0100
+++ b/python/ppci/assembler.py	Sat Mar 01 15:40:31 2014 +0100
@@ -2,7 +2,7 @@
 import re
 import pyyacc
 from . import Token, CompilerError, SourceLocation
-from target import Target, Label
+from .target import Target, Label
 from .asmnodes import ALabel, AInstruction, ABinop, AUnop, ASymbol, ANumber
 
 
@@ -10,7 +10,7 @@
     assert value < (2**31)
     assert value >= 0
     t = 'val32'
-    for n in [8, 5, 3]:
+    for n in [16, 8, 5, 3]:
         if value < (2**n):
             t = 'val{}'.format(n)
     return t
@@ -100,7 +100,7 @@
         # Construct a parser given a grammar:
         tokens2 = ['ID', 'NUMBER', ',', '[', ']', ':', '+', '-', '*',
                    pyyacc.EPS, 'COMMENT', '{', '}',
-                   pyyacc.EOF, 'val32', 'val8', 'val5', 'val3']
+                   pyyacc.EOF, 'val32', 'val16', 'val8', 'val5', 'val3']
         tokens2.extend(kws)
         self.kws = kws
         g = pyyacc.Grammar(tokens2)
@@ -132,7 +132,7 @@
         g.start_symbol = 'asmline'
         self.emit = emit
         self.p = g.generate_parser()
-        print('length of table:', len(self.p.action_table))
+        # print('length of table:', len(self.p.action_table))
 
     # Parser handlers:
     def p_ins_1(self, opc, ops):