diff python/testc3.py @ 155:b28a11c01dbe

Simplified IR classes
author Windel Bouwman
date Sun, 03 Mar 2013 13:20:03 +0100
parents b73bc14a3aa3
children 8f3924b6076e
line wrap: on
line diff
--- a/python/testc3.py	Sat Mar 02 10:19:38 2013 +0100
+++ b/python/testc3.py	Sun Mar 03 13:20:03 2013 +0100
@@ -10,30 +10,30 @@
     var u32 b;
     var int a = 10;
     b = 20;
-    var int88 buf;
+    var int buf;
     var int i;
     i = 2;
-    zero = i - 2;
+    var int zero = i - 2;
     if (i > 1)
     {
-       buf = b + 22 * i - 13 + (55 * 2 *9-2) / 44 - one
+       buf = b + 22 * i - 13 + (55 * 2 *9-2) / 44 - 1
     }
+    else
+    {
+      ;;;
+    };
+
+    t2(2, 3);
 }
 
 function int t2(u32 a, u32 b)
 {
    return a + b;
-   a = 2
+   a = 2;// + t2(2);
 }
 
-var u8 hahaa = 23 * 2;
+var int hahaa = 23 * 2;
 
-function int t2(u32 a, u32 b)
-{
-   return a + b;
-   a = 2 + 33 * 1 - 3;
-   a = a - 2
-}
 
 """
 
@@ -50,7 +50,7 @@
 
 def c3compile(src, diag):
    print('[0] source:')
-   print(src)
+   #print(src)
    print('[1] parsing')
    sema = c3.Semantics(diag)
    p = c3.Parser(sema, diag)
@@ -71,11 +71,14 @@
       print('ERROR:')
       ppci.printError(testsrc, d)
    print('[2] ast:')
-   printAst(sema.mod)
+   #printAst(sema.mod)
 
    ok = len(diag.diags) == 0
    if ok:
-      cg.gencode(sema.mod)
+      print('Generating code')
+      i = cg.gencode(sema.mod)
+      print(i)
+      print(i.Globals)
    else:
       print('Not generating code')