diff python/c3/astnodes.py @ 222:c3f1ce8b638f

Fixup of parser
author Windel Bouwman
date Tue, 09 Jul 2013 17:36:31 +0200
parents 848c4b15fd0b
children 1c7364bd74c7
line wrap: on
line diff
--- a/python/c3/astnodes.py	Mon Jul 08 22:21:44 2013 +0200
+++ b/python/c3/astnodes.py	Tue Jul 09 17:36:31 2013 +0200
@@ -74,8 +74,12 @@
    def __repr__(self):
       return 'Named type {0} of type {1}'.format(self.name, self.typ)
 
-#class TypeCast(Node):
-#    def __init__(self, 
+class TypeCast(Node):
+    def __init__(self, to_type, x):
+        self.to_type = to_type
+        self.a = x
+    def __repr__(self):
+        return 'TYPECAST'
 
 # Variables, parameters, local variables, constants:
 class Symbol(Node):
@@ -190,7 +194,7 @@
    def __repr__(self):
       return 'RETURN STATEMENT'
 
-class Assignment(Node):
+class Assignment(Statement):
     def __init__(self, lval, rval, loc):
         assert isinstance(lval, Node)
         assert isinstance(rval, Node)
@@ -202,6 +206,14 @@
     def __repr__(self):
         return 'ASSIGNMENT'
 
+class ExpressionStatement(Statement):
+    def __init__(self, ex, loc):
+        self.ex = ex
+        self.loc = loc
+        assert isinstance(loc, SourceLocation)
+    def __repr__(self):
+        return 'Epression'
+
 class IfStatement(Statement):
    def __init__(self, condition, truestatement, falsestatement, loc):
       self.condition = condition