annotate python/c3/astnodes.py @ 148:e5263f74b287

Added c3 language frontend initial parser
author Windel Bouwman
date Fri, 01 Mar 2013 10:24:01 +0100
parents
children 74241ca312cc
rev   line source
148
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
1 """
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
2 AST nodes for the c3 language.
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
3 """
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
4
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
5 class Node:
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
6 location = None
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
7 def getChildren(self):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
8 children = []
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
9 members = dir(self)
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
10 for member in members:
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
11 member = getattr(self, member)
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
12 if isinstance(member, Node):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
13 children.append(member)
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
14 elif type(member) is list:
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
15 for mi in member:
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
16 if isinstance(mi, Node):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
17 children.append(mi)
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
18 return children
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
19
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
20
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
21 class Id(Node):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
22 def __init__(self, tok, pub):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
23 self.name = tok.val
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
24 self.is_public = pub
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
25 def __repr__(self):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
26 return 'ID {0}'.format(self.name)
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
27
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
28 # Selectors:
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
29 class Designator(Node):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
30 def __init__(self, obj, selectors, typ):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
31 self.obj = obj
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
32 self.selectors = selectors
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
33 self.typ = typ
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
34 def __repr__(self):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
35 return 'DESIGNATOR {0}, selectors {1}, type {2}'.format(self.obj, self.selectors, self.typ)
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
36
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
37 """
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
38 Type classes
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
39 """
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
40 def isType(a, b):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
41 """ Compare types a and b and check if they are equal """
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
42 if type(a) is type(b):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
43 if type(a) is BaseType:
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
44 return (a.name == b.name) and (a.size == b.size)
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
45 elif type(a) is ProcedureType:
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
46 if len(a.parameters) != len(b.parameters):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
47 print('Number of parameters does not match')
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
48 return False
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
49 for aparam, bparam in zip(a.parameters, b.parameters):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
50 if not isType(aparam.typ, bparam.typ):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
51 print('Parameter {0} does not match parameter {1}'.format(aparam, bparam))
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
52 return False
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
53 if a.result is None:
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
54 # TODO: how to handle a None return type??
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
55 pass
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
56 if not isType(a.result, b.result):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
57 print('Procedure return value mismatch {0} != {1}'.format(a.result, b.result))
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
58 return False
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
59 return True
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
60 else:
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
61 print(a)
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
62 print(b)
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
63 Error('Not implemented {0}'.format(a))
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
64 else:
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
65 return False
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
66
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
67 class Type:
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
68 def isType(self, b):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
69 return isType(self, b)
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
70
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
71 class BaseType(Type):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
72 def __init__(self, name):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
73 self.name = name
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
74 def __repr__(self):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
75 return '[TYPE {0}]'.format(self.name)
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
76
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
77 class FunctionType(Type):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
78 def __init__(self, parameters, returntype):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
79 self.parameters = parameters
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
80 self.returntype = returntype
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
81 def __repr__(self):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
82 return '[PROCTYPE {0} RET {1}]'.format(self.parameters, self.returntype)
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
83
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
84 class DefinedType(Type):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
85 def __init__(self, name, typ):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
86 self.name = name
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
87 self.typ = typ
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
88 def __repr__(self):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
89 return 'Named type {0} of type {1}'.format(self.name, self.typ)
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
90
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
91 # Variables, parameters, local variables, constants:
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
92 class Symbol(Node):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
93 pass
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
94
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
95 class Constant(Symbol):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
96 def __init__(self, value, typ, name=None, public=False):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
97 self.name = name
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
98 self.value = value
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
99 self.typ = typ
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
100 self.public = public
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
101 def __repr__(self):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
102 return 'CONSTANT {0} = {1}'.format(self.name, self.value)
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
103
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
104 class Variable(Symbol):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
105 def __init__(self, name, typ, public):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
106 self.name = name
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
107 self.typ = typ
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
108 self.public = public
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
109 self.isLocal = False
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
110 self.isReadOnly = False
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
111 self.isParameter = False
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
112 def __repr__(self):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
113 txt = '[public] ' if self.public else ''
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
114 return '{2}VAR {0} : {1}'.format(self.name, self.typ, txt)
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
115
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
116 class Parameter(Node):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
117 """ A parameter has a passing method, name and typ """
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
118 def __init__(self, name, typ):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
119 self.name = name
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
120 self.typ = typ
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
121 def __repr__(self):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
122 return 'PARAM {0} {1}'.format(self.name, self.typ)
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
123
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
124 # Operations:
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
125 class Unop(Node):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
126 def __init__(self, a, op):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
127 self.a = a
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
128 self.op = op
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
129 def __repr__(self):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
130 return 'UNOP {0}'.format(self.op)
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
131
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
132 class Binop(Node):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
133 def __init__(self, a, op, b):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
134 self.a = a
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
135 self.b = b
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
136 self.op = op # Operation: '+', '-', '*', '/', 'mod'
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
137 def __repr__(self):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
138 return 'BINOP {0} {1}'.format(self.op, self.typ)
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
139
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
140 # Modules
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
141 class Package(Node):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
142 def __init__(self, name):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
143 self.name = name
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
144 def __repr__(self):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
145 return 'PACKAGE {0}'.format(self.name)
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
146
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
147 # Procedure types
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
148 class Procedure(Symbol):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
149 """ Actual implementation of a function """
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
150 def __init__(self, name, typ, block):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
151 self.name = name
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
152 self.block = block
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
153 self.typ = typ
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
154 def __repr__(self):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
155 return 'PROCEDURE {0} {1}'.format(self.name, self.typ)
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
156
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
157 # Statements
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
158 class CompoundStatement(Node):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
159 def __init__(self, statements):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
160 self.statements = statements
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
161 def __repr__(self):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
162 return 'COMPOUND STATEMENT'
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
163
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
164 class EmptyStatement(Node):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
165 def __repr__(self):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
166 return 'EMPTY STATEMENT'
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
167
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
168 class Assignment(Node):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
169 def __init__(self, lval, rval):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
170 self.lval = lval
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
171 self.rval = rval
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
172 def __repr__(self):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
173 return 'ASSIGNMENT'
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
174
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
175 class ProcedureCall(Node):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
176 def __init__(self, proc, args):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
177 self.proc = proc
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
178 self.args = args
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
179 def __repr__(self):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
180 return 'CALL {0} '.format(self.proc)
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
181
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
182 class IfStatement(Node):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
183 def __init__(self, condition, truestatement, falsestatement=None):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
184 self.condition = condition
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
185 self.truestatement = truestatement
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
186 self.falsestatement = falsestatement
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
187 def __repr__(self):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
188 return 'IF-statement'
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
189
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
190 class WhileStatement(Node):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
191 def __init__(self, condition, statements):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
192 self.condition = condition
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
193 self.dostatements = statements
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
194 def __repr__(self):
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
195 return 'WHILE-statement'
e5263f74b287 Added c3 language frontend initial parser
Windel Bouwman
parents:
diff changeset
196