Jelajahi Sumber

Some minor tweaks.

Taddeüs Kroes 14 tahun lalu
induk
melakukan
e68aee21f7
2 mengubah file dengan 5 tambahan dan 5 penghapusan
  1. 3 3
      src/optimize.py
  2. 2 2
      src/parser.py

+ 3 - 3
src/optimize.py

@@ -12,11 +12,11 @@ if __name__ == '__main__':
     statements = parse_file(argv[1])
     blocks = find_basic_blocks(statements)
 
-    #for i, statement in enumerate(statements):
-    #    print i, statement
+    statement_no = 1
 
     for i, block in enumerate(blocks):
         print '\nbasic block %d:' % i
 
         for statement in block:
-            print statement
+            print statement_no, statement
+            statement_no += 1

+ 2 - 2
src/parser.py

@@ -73,11 +73,11 @@ def p_instruction_command(p):
 
 def p_instruction_directive(p):
     'instruction : DIRECTIVE'
-    statements.append(('directive', p[1], {}))
+    statements.append(('directive', p[1], None))
 
 def p_instruction_label(p):
     'instruction : WORD COLON'
-    statements.append(('label', p[1], {}))
+    statements.append(('label', p[1], None))
 
 def p_command(p):
     '''command : WORD WORD COMMA WORD COMMA WORD