summaryrefslogtreecommitdiffstats
path: root/src/front/ast.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/front/ast.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/front/ast.py b/src/front/ast.py
index 77aab95..f272ca2 100644
--- a/src/front/ast.py
+++ b/src/front/ast.py
@@ -149,6 +149,18 @@ class ReturnStatement(Statement):
def __repr__(self):
return "<ReturnStatement at line %d>" % self.lineno
+class PrintStatement(Statement):
+ def __init__(self, expression, lineno = -1):
+ self.expression = expression
+ self.lineno = lineno
+
+ def generate(self, before, after, last):
+ self.debug("PrintStatement.generate(before = %d, after = %d): %s" % (before, after, repr(self)))
+ self.emit(Op.PRINT, self.expression.reduce(), last)
+
+ def __repr__(self):
+ return "<PrintStatement at line %d>" % self.lineno
+
class AssignStatement(Statement):
def __init__(self, ident, expression, lineno = -1):
self.ident = ident