Mercurial > lcfOS
comparison python/c3/astnodes.py @ 158:9683a4cd848f
Added some functions for code generation
author | Windel Bouwman |
---|---|
date | Fri, 08 Mar 2013 16:52:44 +0100 |
parents | b28a11c01dbe |
children | 8104fc8b5e90 |
comparison
equal
deleted
inserted
replaced
157:8f3924b6076e | 158:9683a4cd848f |
---|---|
143 self.statements = statements | 143 self.statements = statements |
144 def __repr__(self): | 144 def __repr__(self): |
145 return 'COMPOUND STATEMENT' | 145 return 'COMPOUND STATEMENT' |
146 | 146 |
147 class EmptyStatement(Node): | 147 class EmptyStatement(Node): |
148 pass | 148 def __repr__(self): |
149 return 'NOP' | |
149 | 150 |
150 class ReturnStatement(Node): | 151 class ReturnStatement(Node): |
151 def __init__(self, expr): | 152 def __init__(self, expr): |
152 self.expr = expr | 153 self.expr = expr |
153 def __repr__(self): | 154 def __repr__(self): |
166 self.args = args | 167 self.args = args |
167 def __repr__(self): | 168 def __repr__(self): |
168 return 'CALL {0} '.format(self.proc) | 169 return 'CALL {0} '.format(self.proc) |
169 | 170 |
170 class IfStatement(Node): | 171 class IfStatement(Node): |
171 def __init__(self, condition, truestatement, falsestatement=None): | 172 def __init__(self, condition, truestatement, falsestatement): |
172 self.condition = condition | 173 self.condition = condition |
173 self.truestatement = truestatement | 174 self.truestatement = truestatement |
174 self.falsestatement = falsestatement | 175 self.falsestatement = falsestatement |
175 def __repr__(self): | 176 def __repr__(self): |
176 return 'IF-statement' | 177 return 'IF-statement' |